dbus-cleanup-sockets can use a lot of memory and or crash
Submitted by dbus???
Assigned to D-Bus Maintainers
Description
dbus-cleanup-sockets can use a lot of memory or crash when there is a large number of files in /tmp with a prefix "dbus-".
in dbus-cleanup-sockets.c if the system has sufficient memory and the filesystem permits creating enough files such that n_entries wraps around (becomes negative) then the 'while ((dent = readdir (dirh)))' loop will crash on the line "entries[n_entries] = se;"
A partial fix for this issue may look like the following:
static void read_sockets (const char *dir, SocketEntry ***entries_p, int *n_entries_p) { DIR *dirh; struct dirent *dent; SocketEntry **entries;
- int n_entries;
- unsigned short int n_entries; int allocated;
Version: 1.5