Commit c1b32892 authored by Michael McConville's avatar Michael McConville
Browse files

Check for allocation failure

Pointed out by Michael Reed.
parent ae5c01f4
......@@ -139,7 +139,8 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
for (i = 0; arg[i] != NULL; i++) {
len += strlen(arg[i]) + 1;
}
buf = s = malloc(len);
if ((buf = s = malloc(len)) == NULL)
err(1, NULL);
for (i = 0; arg[i] != NULL; i++) {
n = strlcpy(buf, arg[i], (s + len) - buf);
buf += n;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment