From: Kamil Dudka Date: Mon, 8 Mar 2010 10:34:58 +0000 (+0200) Subject: Fix possible overflow in code_timespec (tiny change) X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftar;a=commitdiff_plain;h=46b07a52f9dcd3f0a298dfaf85fc0cf502d019dc Fix possible overflow in code_timespec (tiny change) * src/misc.c (code_timespec): ignore invalid values of ns --- diff --git a/src/misc.c b/src/misc.c index cdb2608..f81111f 100644 --- a/src/misc.c +++ b/src/misc.c @@ -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++;