[Top][All Lists]

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

Re: [gpsd-dev] C Client API Issues

From: Robert Norris
Subject: Re: [gpsd-dev] C Client API Issues
Date: Thu, 21 Jul 2016 19:19:45 +0000

> From: Hal Murray <address@hidden>
>address@hidden 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.


reply via email to

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