The Samba-Bugzilla – Attachment 15054 Details for
Bug 13892
getline() doesn't expect *n to be random
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch.txt (text/plain), 1.75 KB, created by
Volker Lendecke
on 2019-04-09 11:18:46 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2019-04-09 11:18:46 UTC
Size:
1.75 KB
patch
obsolete
>From e69cd9bc8ddffcc5596bec2e05e0cb70d7a57dac Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Tue, 9 Apr 2019 12:47:13 +0200 >Subject: [PATCH 1/2] 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 <vl@samba.org> >--- > 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) { >-- >2.11.0 > > >From abf5827cf75f8d3c9b3c25ea86d4f2daaacc209d Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Tue, 9 Apr 2019 12:49:00 +0200 >Subject: [PATCH 2/2] lib: Initialize variables in parse_resolvconf_fp > >Signed-off-by: Volker Lendecke <vl@samba.org> >--- > libcli/dns/resolvconf.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/libcli/dns/resolvconf.c b/libcli/dns/resolvconf.c >index ee2eec6573b..5cf8b4e7882 100644 >--- a/libcli/dns/resolvconf.c >+++ b/libcli/dns/resolvconf.c >@@ -36,9 +36,9 @@ int parse_resolvconf_fp( > int ret = 0; > > while (true) { >- char *saveptr, *option, *ns; >- char **tmp; >- ssize_t n; >+ char *saveptr = NULL, *option = NULL, *ns = NULL; >+ char **tmp = NULL; >+ ssize_t n = 0; > > n = getline(&line, &len, fp); > if (n < 0) { >-- >2.11.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 13892
:
15053
| 15054 |
15078