diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2026-02-02 17:18:11 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2026-02-02 17:18:11 +0000 |
| commit | 03d8ac948b1ad9c419b294c3129b7da58d818363 (patch) | |
| tree | f0d882e2107edb1464bd3f966a6f27092f9ec7c3 | |
| parent | 7f54c65abc67f50363bbd2a68a980d23e69c9ef0 (diff) | |
heimdal: Pass the correct pointer to realloc when growing a string buffer
The realloc in my_fgetln was trying to grow the pointer to the string
buffer, not the string buffer itself.
In function 'my_fgetln',
inlined from 'mit_prop_dump' at crypto/heimdal/kdc/mit_dump.c:156:19:
crypto/heimdal/kdc/mit_dump.c:119:13: error: 'realloc' called on unallocated object 'line' [-Werror=free-nonheap-object]
119 | n = realloc(buf, *sz + (*sz >> 1));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
crypto/heimdal/kdc/mit_dump.c: In function 'mit_prop_dump':
crypto/heimdal/kdc/mit_dump.c:139:11: note: declared here
139 | char *line = NULL;
| ^~~~
Reviewed by: rmacklem, cy
Fixes: a93e1b731ae4 ("heimdal-kadmin: Add support for the -f dump option")
Differential Revision: https://reviews.freebsd.org/D54933
| -rw-r--r-- | crypto/heimdal/kdc/mit_dump.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/heimdal/kdc/mit_dump.c b/crypto/heimdal/kdc/mit_dump.c index 4397d1ad897d..d790b145af11 100644 --- a/crypto/heimdal/kdc/mit_dump.c +++ b/crypto/heimdal/kdc/mit_dump.c @@ -116,7 +116,7 @@ my_fgetln(FILE *f, char **buf, size_t *sz, size_t *len) return 0; } *len += strlen(&(*buf)[*len]); /* *len should be == *sz */ - n = realloc(buf, *sz + (*sz >> 1)); + n = realloc(*buf, *sz + (*sz >> 1)); if (!n) { free(*buf); *buf = NULL; |
