]> Dogcows Code - chaz/tar/blobdiff - src/misc.c
Fix possible overflow in code_timespec (tiny change)
[chaz/tar] / src / misc.c
index cdb2608aa45511cee77721445d4bca2a6e4fa880..f81111f197d53c53c4321668f13e58ca2b9c4324 100644 (file)
@@ -298,6 +298,10 @@ code_timespec (struct timespec t, char sbuf[TIMESPEC_STRSIZE_BOUND])
   char *np;
   bool negative = s < 0;
 
+  /* ignore invalid values of ns */
+  if (BILLION <= ns || ns < 0)
+    ns = 0;
+  
   if (negative && ns != 0)
     {
       s++;
This page took 0.019462 seconds and 4 git commands to generate.