diff options
| author | Ed Maste <emaste@FreeBSD.org> | 2025-04-11 18:37:39 +0000 |
|---|---|---|
| committer | Ed Maste <emaste@FreeBSD.org> | 2025-04-11 18:42:44 +0000 |
| commit | 4b60fac3a5c7a53f6d1a4480f37eb906bbacf21b (patch) | |
| tree | 61cdc2fd67574b6d490aead766c9997239ee08ea /lib/libutil | |
| parent | 7c72c0822b946626909f5a538d66a43d63c778dc (diff) | |
Diffstat (limited to 'lib/libutil')
| -rw-r--r-- | lib/libutil/kinfo_getfile.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libutil/kinfo_getfile.c b/lib/libutil/kinfo_getfile.c index f1441bdf771a..345da657df81 100644 --- a/lib/libutil/kinfo_getfile.c +++ b/lib/libutil/kinfo_getfile.c @@ -27,6 +27,10 @@ kinfo_getfile(pid_t pid, int *cntp) error = sysctl(mib, nitems(mib), NULL, &len, NULL, 0); if (error) return (NULL); + /* + * Add extra space as the table may grow between requesting the size + * and fetching the data. + */ len = len * 4 / 3; buf = malloc(len); if (buf == NULL) |
