libkvm - Fix seg-fault in ps output when loading a process's argv
authorMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Dec 2011 23:53:24 +0000 (15:53 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Thu, 1 Dec 2011 23:53:24 +0000 (15:53 -0800)
* An offset calculation used when the string space is relocated by realloc
  was being stored in an 'int' instead of a 'size_t', causing the
  recalculated pointer to go wild.

lib/libkvm/kvm_proc.c

index 95f64ef..2ccef66 100644 (file)
@@ -675,7 +675,7 @@ kvm_argv(kvm_t *kd, pid_t pid, u_long addr, int narg, int maxcnt)
 
                /* will we exceed the malloc/realloced buffer? */
                if (len + cc > kd->arglen) {
-                       int off;
+                       size_t off;
                        char **pp;
                        char *op = kd->argspc;