[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250215204143.0ae30525@hermes.local>
Date: Sat, 15 Feb 2025 20:41:43 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Anton Moryakov <ant.v.moryakov@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH] ip: handle NULL return from localtime in strxf_time in
On Sun, 16 Feb 2025 05:25:23 +0300
Anton Moryakov <ant.v.moryakov@...il.com> wrote:
> Static analyzer reported:
> Pointer 'tp', returned from function 'localtime' at ipxfrm.c:352, may be NULL
> and is dereferenced at ipxfrm.c:354 by calling function 'strftime'.
>
> Corrections explained:
> The function localtime() may return NULL if the provided time value is
> invalid. This commit adds a check for NULL and handles the error case
> by copying "invalid-time" into the output buffer.
> Unlikely, but may return an error
>
> Triggers found by static analyzer Svace.
>
> Signed-off-by: Anton Moryakov <ant.v.moryakov@...il.com>
Seems like you are creating dead code. Unless glibc is broken
this can never happen.
Powered by blists - more mailing lists