From dc9d7b08aa62743e7cbfb1795c324b3c1773ecd0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 15 May 2013 10:49:54 +1000 Subject: - Silence benign static analysis warnings. [ISC-Bugs #33428] --- dhcpctl/omshell.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'dhcpctl') diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c index bb489d84..22506eec 100644 --- a/dhcpctl/omshell.c +++ b/dhcpctl/omshell.c @@ -3,7 +3,7 @@ Examine and modify omapi objects. */ /* - * Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009-2011,2013 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2001-2003 by Internet Software Consortium * @@ -466,8 +466,12 @@ main(int argc, char **argv) { break; } - s1[0] = '\0'; - strncat (s1, val, sizeof(s1)-1); +#ifdef HAVE_STRLCPY + strlcpy (s1, val, sizeof(s1)); +#else + s1[0] = 0; + strncat (s1, val, sizeof(s1)-strlen(s1)-1); +#endif token = next_token (&val, (unsigned *)0, cfile); if (token != EQUAL) @@ -570,8 +574,12 @@ main(int argc, char **argv) { break; } - s1[0] = '\0'; - strncat (s1, val, sizeof(s1)-1); +#if HAVE_STRLCPY + strlcpy (s1, val, sizeof(s1)); +#else + s1[0] = 0; + strncat (s1, val, sizeof(s1)-strlen(s1)-1); +#endif token = next_token (&val, (unsigned *)0, cfile); if (token != END_OF_FILE && token != EOL) -- cgit v1.2.1