mirror of
git://anongit.mindrot.org/openssh.git
synced 2025-02-16 13:56:52 +00:00
Defer setting bufsiz in getdelim.
Do not write to bufsiz until we are sure the malloc has succeeded, in case any callers rely on it (which they shouldn't). ok djm@
This commit is contained in:
parent
3deb56f719
commit
872517ddbb
@ -53,9 +53,9 @@ getdelim(char **buf, size_t *bufsiz, int delimiter, FILE *fp)
|
||||
|
||||
|
||||
if (*buf == NULL || *bufsiz == 0) {
|
||||
*bufsiz = BUFSIZ;
|
||||
if ((*buf = malloc(*bufsiz)) == NULL)
|
||||
if ((*buf = malloc(BUFSIZ)) == NULL)
|
||||
return -1;
|
||||
*bufsiz = BUFSIZ;
|
||||
}
|
||||
|
||||
for (ptr = *buf, eptr = *buf + *bufsiz;;) {
|
||||
|
Loading…
Reference in New Issue
Block a user