mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-01-09 03:08:38 +01:00
Fix buffer leaks in fgetln
Cache the size and the buffer allocated by getline as static variables.
This commit is contained in:
parent
deb9f56ceb
commit
74ae34e792
@ -34,8 +34,8 @@
|
||||
char *
|
||||
fgetln (FILE *stream, size_t *len)
|
||||
{
|
||||
char *line = NULL;
|
||||
size_t line_len = 0;
|
||||
static char *line = NULL;
|
||||
static size_t line_len = 0;
|
||||
ssize_t nread;
|
||||
|
||||
nread = getline(&line, &line_len, stream);
|
||||
|
Loading…
Reference in New Issue
Block a user