summaryrefslogtreecommitdiff
blob: a2809087f820b065184eec37bdd5579e40f188ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- gvm-libs-9.0.3/nasl/nasl_isotime.c	2018-08-29 19:01:12.000000000 +0300
+++ gvm-libs-9.0.3/nasl/nasl_isotime.c	2019-02-01 21:11:40.460358131 +0300
@@ -102,9 +102,13 @@
       struct tm *tp;
 
       tp = gmtime (&atime);
-      snprintf (timebuf, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
+      if (snprintf (timebuf, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
                 1900 + tp->tm_year, tp->tm_mon+1, tp->tm_mday,
-                tp->tm_hour, tp->tm_min, tp->tm_sec);
+                tp->tm_hour, tp->tm_min, tp->tm_sec) < 0)
+        {
+          *timebuf = '\0';
+          return;
+        }
     }
 }
 
@@ -480,8 +484,9 @@
       || year < 0 || month < 1 || day < 1)
     return 1;
 
-  snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
-            year, month, day, hour, minute, sec);
+  if (snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
+              year, month, day, hour, minute, sec) < 0)
+    return 1;
   return 0;
 }
 
@@ -519,8 +524,9 @@
       || year < 0 || month < 1 || day < 1)
     return 1;
 
-  snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
-            year, month, day, hour, minute, sec);
+  if (snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
+            year, month, day, hour, minute, sec) < 0)
+    return 1;
   return 0;
 }
 
@@ -558,13 +564,14 @@
       || year < 0 || month < 1 || day < 1)
     return 1;
 
-  snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
-            year, month, day, hour, minute, sec);
+  if (snprintf (atime, ISOTIME_SIZE, "%04d%02d%02dT%02d%02d%02d",
+                year, month, day, hour, minute, sec) < 0)
+    return 1;
   return 0;
 }
 
 
-
+
 /**
  * @brief Return the current time in ISO format
  * @naslfn{isotime_now}
@@ -784,9 +791,9 @@
   memcpy (timebuf, string, ISOTIME_SIZE -1);
   timebuf[ISOTIME_SIZE - 1] = 0;
 
-  nyears = get_int_local_var_by_name (lexic, "years", 0);
-  ndays = get_int_local_var_by_name (lexic, "days", 0);
-  nseconds = get_int_local_var_by_name (lexic, "seconds", 0);
+  nyears = get_int_var_by_name (lexic, "years", 0);
+  ndays = get_int_var_by_name (lexic, "days", 0);
+  nseconds = get_int_var_by_name (lexic, "seconds", 0);
 
   if (nyears && add_years_to_isotime (timebuf, nyears))
     return NULL;