Re: nfsd: fix memory overflow for haddr
Steve Dickson <[email protected]> Thu, 23 Jul 2026 08:26:39 -0400
| Newsgroups | org.kernel.vger.linux-nfs |
|---|---|
| Message-ID | <[email protected]> |
On 7/14/26 4:43 AM, zhangjian (CG) wrote: > when hcounter is not 0, haddr memory is not enough. > asan report heap-buffer-overflow error in following scene: > CFLAGS="-fsanitize=address -g" ./configure && make > ./utils/nfsd/nfsd -H 192.168.1.1 -H 192.168.1.2 > > Signed-off-by: zhangjian <[email protected]> Committed... (tag: nfs-utils-2-9-2-rc6) steved.> --- > utils/nfsd/nfsd.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c > index c95d32f4..e3fcdde4 100644 > --- a/utils/nfsd/nfsd.c > +++ b/utils/nfsd/nfsd.c > @@ -185,7 +185,7 @@ main(int argc, char **argv) > hcounter = 0; > } > if (hcounter) { > - haddr = realloc(haddr, sizeof(char*) * hcounter+1); > + haddr = realloc(haddr, sizeof(char*) * (hcounter+1)); > if(!haddr) { > fprintf(stderr, "%s: unable to allocate " > "memory.\n", progname);