From cc69e56ce3bead7d61e30ec5770072e2f499773a Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Mon, 2 Jan 2012 13:44:56 +0100 Subject: [PATCH] hostip.c: fix potential write past the end of string buffer --- lib/hostip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hostip.c b/lib/hostip.c index 828d27e42b79f3..503ba483f5a1fe 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -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++; }