artulab
projects
/
openbsd
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b3570ff
)
Use recallocarray in getdelim/getline to clear memory on buffer resizes,
author
brynet
<brynet@openbsd.org>
Thu, 13 Apr 2017 18:36:51 +0000
(18:36 +0000)
committer
brynet
<brynet@openbsd.org>
Thu, 13 Apr 2017 18:36:51 +0000
(18:36 +0000)
inspired by a similar change to fgetln.
ok deraadt millert
lib/libc/stdio/getdelim.c
patch
|
blob
|
history
diff --git
a/lib/libc/stdio/getdelim.c
b/lib/libc/stdio/getdelim.c
index
0e0e338
..
d709a3d
100644
(file)
--- a/
lib/libc/stdio/getdelim.c
+++ b/
lib/libc/stdio/getdelim.c
@@
-1,4
+1,4
@@
-/* $OpenBSD: getdelim.c,v 1.
5 2016/09/21 04:38:56 guenther Exp $
*/
+/* $OpenBSD: getdelim.c,v 1.
6 2017/04/13 18:36:51 brynet Exp $
*/
/* $NetBSD: getdelim.c,v 1.13 2011/07/22 23:12:30 joerg Exp $ */
/*
@@
-103,7
+103,7
@@
getdelim(char **__restrict buf, size_t *__restrict buflen,
newlen++;
}
- newb = re
alloc(*buf, newlen
);
+ newb = re
callocarray(*buf, *buflen, newlen, 1
);
if (newb == NULL)
goto error;
*buf = newb;