diff options
Diffstat (limited to 'freebsd/lib/libc/net/gethostbynis.c')
-rw-r--r-- | freebsd/lib/libc/net/gethostbynis.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/freebsd/lib/libc/net/gethostbynis.c b/freebsd/lib/libc/net/gethostbynis.c index 5cf4b2e0..9a715b1c 100644 --- a/freebsd/lib/libc/net/gethostbynis.c +++ b/freebsd/lib/libc/net/gethostbynis.c @@ -60,7 +60,7 @@ _gethostbynis(const char *name, char *map, int af, struct hostent *he, char *cp, **q; char *result; int resultlen, size, addrok = 0; - char ypbuf[YPMAXRECORD + 2]; + char *ypbuf; res_state statp; statp = __res_state(); @@ -90,10 +90,11 @@ _gethostbynis(const char *name, char *map, int af, struct hostent *he, } /* avoid potential memory leak */ - bcopy((char *)result, (char *)&ypbuf, resultlen); + ypbuf = alloca(resultlen + 2); + bcopy(result, ypbuf, resultlen); ypbuf[resultlen] = '\0'; free(result); - result = (char *)&ypbuf; + result = ypbuf; if ((cp = strchr(result, '\n'))) *cp = '\0'; |