]> granicus.if.org Git - curl/commitdiff
hostip.c: fix potential write past the end of string buffer
authorYang Tse <yangsita@gmail.com>
Mon, 2 Jan 2012 12:44:56 +0000 (13:44 +0100)
committerYang Tse <yangsita@gmail.com>
Mon, 2 Jan 2012 12:44:56 +0000 (13:44 +0100)
lib/hostip.c

index 828d27e42b79f3df5bb3af9eb769534e26c26448..503ba483f5a1fe8cb655a3f28bfb604c38bd255b 100644 (file)
@@ -212,7 +212,7 @@ create_hostcache_id(const char *name, int port)
   char *ptr = id;
   if(ptr) {
     /* lower case the name part */
-    while(*ptr != ':') {
+    while(*ptr && (*ptr != ':')) {
       *ptr = (char)TOLOWER(*ptr);
       ptr++;
     }