[prev in list] [next in list] [prev in thread] [next in thread]
List: gpsd-dev
Subject: Re: [gpsd-dev] C Client API Issues
From: "Gary E. Miller" <gem () rellim ! com>
Date: 2016-07-21 19:35:47
Message-ID: 20160721123547.4e6ce6a4 () spidey ! rellim ! com
[Download RAW message or body]
Yo Robert!
Good analysis. Patches anyone?
On Thu, 21 Jul 2016 19:19:45 +0000
Robert Norris <rw_norris@hotmail.com> wrote:
> > From: Hal Murray <hmurray@megapathdsl.net>
>
> >rw_norris@hotmail.com said:
> > >gpsd needs a flag so close is a noop if it isn't open.
> >> Wouldn't such a flag would need to go into the gps_data_t
> >> structure?
>
> >I was being sloppy when I said "flag". I don't care how it's
> >implemented as long as duplicate calls to close don't cause any
> >problems.
>
> Even though I was on about initialization, currently calling
> gps_close() twice will crash the client with a double free.
>
> privdata should be explicitly set to NULL after the free in
> gps_socket_close().
>
> There also looks to be issues with gps_shm_* functions too, such as:
>
> gps_shm_open() doesn't set gpsdata->privdata to NULL when attaching
> to shared memory fails.
>
> Thus if you tried to then use gps_shm_read() [which you shouldn't do
> anyway] it would probably crash.
>
> gps_shm_close() never checks if gpsdata->privdata is NULL, so again
> it would crash the client if used after an unsuccessful open.
>
> It should be easy to make these more robust against API incorrect use.
>
>
>
>
>
RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
gem@rellim.com Tel:+1 541 382 8588
[Attachment #3 (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic