From: Ben Gras Date: Fri, 3 Feb 2012 13:49:18 +0000 (+0100) Subject: inet: strncmp() fix X-Git-Tag: v3.2.0~86 X-Git-Url: http://zhaoyanbai.com/repos/FAQ?a=commitdiff_plain;h=1eea0f568040e6436fbea3d5c6666cc79c998679;p=minix.git inet: strncmp() fix --- diff --git a/servers/inet/inet.c b/servers/inet/inet.c index d4e974637..eb0f18d8a 100644 --- a/servers/inet/inet.c +++ b/servers/inet/inet.c @@ -339,6 +339,9 @@ PRIVATE void ds_event() int type; endpoint_t owner_endpoint; int r; + int prefix_len; + + prefix_len = strlen(driver_prefix); /* We may get one notification for multiple updates from DS. Get events * and owners from DS, until DS tells us that there are no more. @@ -351,13 +354,13 @@ PRIVATE void ds_event() } /* Only check for network driver up events. */ - if(strncmp(key, driver_prefix, sizeof(driver_prefix)) + if(strncmp(key, driver_prefix, prefix_len) || value != DS_DRIVER_UP) { return; } /* The driver label comes after the prefix. */ - label = key + strlen(driver_prefix); + label = key + prefix_len; /* A driver is (re)started. */ eth_check_driver(label, owner_endpoint);