From 4f80aac6600961c952b9d3547779ad169e382319 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Mon, 2 Aug 2010 08:41:34 +0200 Subject: [PATCH] strcpy to a NULL pointer is bad. Closes bug #98 --- src/lib/valuepair.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/valuepair.c b/src/lib/valuepair.c index 9b9e94c..efe37db 100644 --- a/src/lib/valuepair.c +++ b/src/lib/valuepair.c @@ -808,13 +808,11 @@ static int gettime(const char *valstr, time_t *date) f[2] = strchr(f[1], ':'); /* find : separator */ if (f[2]) { *(f[2]++) = '\0'; /* nuke it, and point to SS */ - } else { - strcpy(f[2], "0"); /* assignment would discard const */ - } + tm->tm_sec = atoi(f[2]); + } /* else leave it as zero */ tm->tm_hour = atoi(f[0]); tm->tm_min = atoi(f[1]); - tm->tm_sec = atoi(f[2]); } /* -- 2.1.4