diff --git a/lib/hostip.c b/lib/hostip.c index 828d27e42..503ba483f 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++; }