]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-decode-der-get: fix coverity warning
authorMats Klepsland <mats.klepsland@gmail.com>
Mon, 26 Sep 2016 13:53:48 +0000 (15:53 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 28 Sep 2016 11:02:44 +0000 (13:02 +0200)
*** CID 1373380:  Control flow issues  (DEADCODE)
/src/util-decode-der-get.c: 126 in UtctimeToTime()
120         year = strtol(yy, NULL, 10);
121         if (year >= 50)
122             snprintf(buf, sizeof(buf), "%i%s", 19, utctime);
123         else if (year < 50)
124             snprintf(buf, sizeof(buf), "%i%s", 20, utctime);
125         else
>>>     CID 1373380:  Control flow issues  (DEADCODE)
>>>     Execution cannot reach this statement: "goto error;".
126             goto error;
127
128         time = GentimeToTime(buf);
129         if (time == -1)
130             goto error;
131

src/util-decode-der-get.c

index 413c43158140b3191dc038350e8867268189387d..747bf4b4226ba16666a033a4e7de8331c509bb73 100644 (file)
@@ -120,10 +120,8 @@ static time_t UtctimeToTime(char *utctime)
     year = strtol(yy, NULL, 10);
     if (year >= 50)
         snprintf(buf, sizeof(buf), "%i%s", 19, utctime);
-    else if (year < 50)
-        snprintf(buf, sizeof(buf), "%i%s", 20, utctime);
     else
-        goto error;
+        snprintf(buf, sizeof(buf), "%i%s", 20, utctime);
 
     time = GentimeToTime(buf);
     if (time == -1)