From c0b2272a7d15d266ce64c86cf6a313b5b0fb67fd Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 9 Apr 2019 12:47:13 +0200 Subject: [PATCH] lib: Initialize getline() arguments Keep "len" valid across the loop iterations for getline to consume Bug: https://bugzilla.samba.org/show_bug.cgi?id=13892 Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- libcli/dns/resolvconf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcli/dns/resolvconf.c b/libcli/dns/resolvconf.c index 90d4e6a74b6..ee2eec6573b 100644 --- a/libcli/dns/resolvconf.c +++ b/libcli/dns/resolvconf.c @@ -30,6 +30,7 @@ int parse_resolvconf_fp( size_t *pnum_nameservers) { char *line = NULL; + size_t len = 0; char **nameservers = NULL; size_t num_nameservers = 0; int ret = 0; @@ -38,7 +39,6 @@ int parse_resolvconf_fp( char *saveptr, *option, *ns; char **tmp; ssize_t n; - size_t len; n = getline(&line, &len, fp); if (n < 0) {