mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-16 11:28:39 +08:00
Update to FreeBSD head 2019-09-24
Git mirror commit 6b0307a0a5184339393f555d5d424190d8a8277a.
This commit is contained in:
@@ -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';
|
||||
|
Reference in New Issue
Block a user