]> Dogcows Code - chaz/tar/commitdiff
Fix possible overflow in code_timespec (tiny change)
authorKamil Dudka <kdudka@redhat.com>
Mon, 8 Mar 2010 10:34:58 +0000 (12:34 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Mon, 8 Mar 2010 10:34:58 +0000 (12:34 +0200)
* src/misc.c (code_timespec): ignore invalid values of ns

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.018772 seconds and 4 git commands to generate.