mount.cifs: fix handling of scopeid in resolve_host
Subsystems (2)
PATCH 1/1 mount.cifs: fix handling of scopeid in resolve_host
We get a pointer to the end of the address string (ipaddr), but the call snprintf and pass in tmpbuf which is a pointer to the beginning of the address string. If someone passes in an address with a scopeid then we end up overwriting the entire address string.
--- resolve_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
resolve_host.c +1 -1
@@ -71,7 +71,7 @@ int resolve_host(const char *host, char *addrstr)if (sin6->sin6_scope_id) { len =strnlen (tmpbuf,sizeof (tmpbuf)); ipaddr = tmpbuf + len; -snprintf (tmpbuf,sizeof (tmpbuf) - len,"%%%u" , +snprintf (ipaddr,sizeof (tmpbuf) - len,"%%%u" , sin6->sin6_scope_id); }break ;
Signature · 1 line
1.7.4
A message that is not in the archive (sent off-list or not yet received): 1297794670-4345-1-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org
Quoted 16 lines · On Tue, 15 Feb 2011 13:31:10 -0500 Jeff Layton…
We get a pointer to the end of the address string (ipaddr), but the call snprintf and pass in tmpbuf which is a pointer to the beginning of the address string. If someone passes in an address with a scopeid then we end up overwriting the entire address string.
Reported-by Björn JACKE <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- resolve_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)resolve_host.c +0
-0
resolve_host.c int resolve_host(const char *host, char *addrstr) · line 77
Quoted 8 lines
resolve_host.c +1
-1@@ -71,7 +71,7 @@ int resolve_host(const char *host, char *addrstr)if (sin6->sin6_scope_id) { len =strnlen (tmpbuf,sizeof (tmpbuf)); ipaddr = tmpbuf + len; -snprintf (tmpbuf,sizeof (tmpbuf) - len,"%%%u" , +snprintf (ipaddr,sizeof (tmpbuf) - len,"%%%u" , sin6->sin6_scope_id); }break ;
Merged, should make 4.9.
Signature · 1 line
Jeff Layton <[email protected]>