From: Roy Marples Date: Fri, 11 May 2007 21:31:14 +0000 (+0000) Subject: Avoid using sizeof for hostname length check X-Git-Tag: v3.2.3~260 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9afd5b02383bcf1f6ed2b12ff4016e5f3720d17f;p=thirdparty%2Fdhcpcd.git Avoid using sizeof for hostname length check --- diff --git a/dhcpcd.c b/dhcpcd.c index 417b3d43..5f264413 100644 --- a/dhcpcd.c +++ b/dhcpcd.c @@ -188,9 +188,9 @@ int main(int argc, char **argv) } break; case 'h': - if (strlen (optarg) > sizeof (options.hostname)) { - logger (LOG_ERR, "`%s' too long for HostName string, max is %lu", - optarg, sizeof (options.hostname)); + if (strlen (optarg) > MAXHOSTNAMELEN) { + logger (LOG_ERR, "`%s' too long for HostName string, max is %d", + optarg, MAXHOSTNAMELEN); exit (EXIT_FAILURE); } else strlcpy (options.hostname, optarg, sizeof (options.hostname));