gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [PATCH] Add Windows versions of time related functions.


From: Gary E. Miller
Subject: Re: [gpsd-dev] [PATCH] Add Windows versions of time related functions.
Date: Sun, 20 Mar 2016 14:34:27 -0700

Yo Robert!

On Sun, 20 Mar 2016 12:20:03 +0000
Robert Norris <address@hidden> wrote:

> OK thanks for the advice.
> 
> I've rewritten the patch using strtok() instead of sscanf().

Looks good to me.  I'm not saying there's not a bug in there, just
saying it does not raise many red flags for me.

> Although I've just re-read your message - so I need to add some range
> checking before I post the new version.

Yup. And a bit more.

>     char *isotime_tokenizer = strdup(isotime);

No check for NULL.

>     char *pch = strtok(isotime_tokenizer, "-T:");

Maybe use strtok_r() to be thread safe?

>     int token_number = 0;
>     while ( pch != NULL ) {

May
>       token_number++;

No check for too many or too few tokens.

>     (void)mktime(&tm); // Normalizes tm so that tm_yday is set

Do not ignore possible error return.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

Attachment: pgpyIsGdZDm6G.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]