From: Wouter Verhelst Date: Tue, 26 Nov 2013 13:32:31 +0000 (+0100) Subject: Use strcmp() rather than strncmp() X-Git-Tag: nbd-3.5~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df890c99337a255979e608d71f42401c0cddd5e0;p=platform%2Fupstream%2Fnbd.git Use strcmp() rather than strncmp() This results in some false positives. If the authfile contains: 192.168.0.12 and the client is 192.168.0.1 then access will be granted, because the strcmp was limiting to "192.168.0.1" for no particularly good reason. We should also canonicalize our names and work on that, rather than doing a simple strcmp(), but that's for later. --- diff --git a/nbd-server.c b/nbd-server.c index 1cd25bc..080659d 100644 --- a/nbd-server.c +++ b/nbd-server.c @@ -364,7 +364,7 @@ int authorized_client(CLIENT *opts) { return 1; } } - if (strncmp(line,opts->clientname,strlen(opts->clientname))==0) { + if (strcmp(line,opts->clientname)==0) { fclose(f); return 1; }