[proc] Fix potential buffer overflow
authorLudovic Henry <ludovic@xamarin.com>
Wed, 3 Feb 2016 12:40:15 +0000 (12:40 +0000)
committerLudovic Henry <ludovic@xamarin.com>
Wed, 3 Feb 2016 12:42:25 +0000 (12:42 +0000)
mono/utils/mono-proclib.c

index c4e20e4ed42400bad8e38c6ddb3a8ff100d13b87..9bf6ca52ae0188a5f93badde282e87aa21ef4510 100644 (file)
@@ -187,7 +187,7 @@ get_pid_status_item_buf (int pid, const char *item, char *rbuf, int blen, MonoPr
                        *error = MONO_PROCESS_ERROR_NOT_FOUND;
                return NULL;
        }
-       while ((s = fgets (buf, blen, f))) {
+       while ((s = fgets (buf, sizeof (buf), f))) {
                if (*item != *buf)
                        continue;
                if (strncmp (buf, item, len))