Patch for 4.1.1.
Essentially all that is needed to get rid of this issue is the
addition of:
memset(u, 0, sizeof(*u));
after:
if (!(u = malloc(sizeof(*u
break;
Also patched some other situations (strcpy and sprintf uses) that
potentially produce the same results.
Note:
Patches are always appreciated and this looks like a real bug.
But before I can accept it there are a couple of small
changes needed.
1. There is no need to check for NULL when calling free().
Glibc free is documented to accept NULL as a valid request
and do nothing.
2. Please add a Signed-
NULL) {
if (fscanf(fp, "%*d (%[^)])", procname) == 1) {
- sprintf(procname+strlen(procname),
"/%d", pid);
+ snprintf(procname+strlen(procname),
+