mount.cifs: fix handling of scopeid in resolve_host
authorJeff Layton <jlayton@samba.org>
Tue, 15 Feb 2011 18:30:47 +0000 (13:30 -0500)
committerJeff Layton <jlayton@samba.org>
Tue, 15 Feb 2011 18:30:47 +0000 (13:30 -0500)
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 <bj@sernet.de>
Signed-off-by: Jeff Layton <jlayton@samba.org>
resolve_host.c

index 7687503f5fbf39fb756a8abd6aa57c9ccece2e3c..69859a3119cfe39788bfd80b45bc1f230e9c301f 100644 (file)
@@ -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;