diff options
Diffstat (limited to 'nscd/netgroupcache.c')
-rw-r--r-- | nscd/netgroupcache.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/nscd/netgroupcache.c b/nscd/netgroupcache.c index 58234b1492..924567c3f3 100644 --- a/nscd/netgroupcache.c +++ b/nscd/netgroupcache.c @@ -241,7 +241,17 @@ addgetnetgrentX (struct database_dyn *db, int fd, request_header *req, if (buflen - req->key_len - bufused < needed) { buflen += MAX (buflen, 2 * needed); - buffer = xrealloc (buffer, buflen); + char *newbuf = xrealloc (buffer, buflen); + /* Adjust the pointers in the new + buffer. */ + nhost = (nhost ? newbuf + (nhost - buffer) + : NULL); + nuser = (nuser ? newbuf + (nuser - buffer) + : NULL); + ndomain = (ndomain + ? newbuf + (ndomain - buffer) + : NULL); + buffer = newbuf; } nhost = memcpy (buffer + bufused, |