diff options
author | Andrey Mazo <mazo@telum.ru> | 2013-09-26 21:06:05 +0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-09-26 13:34:44 -0400 |
commit | 832e1fb1749ee24583d2f7f1dc7ce7b9e68126f9 (patch) | |
tree | d1c2b0aa4a24e66d345a7048586ac1147ae958f3 /libgps_dbus.c | |
parent | ab7d706918b859f5cc38f520c8d41098de411a89 (diff) | |
download | gpsd-832e1fb1749ee24583d2f7f1dc7ce7b9e68126f9.tar.gz |
Fixed incorrect string argument to dbus_message_get_args().
Existing behavior leads to unexpected results because it's actually
something like
static char gpsd_devname[BUFSIZ];
...
*((char**)&gpsd_devname) = "qqq";
which actually stores address of "qqq" in first several bytes of gpsd_devname[] (at least with gcc and clang).
DBus documentation on dbus_message_get_args() [1] states that
"The variable argument list should contain the type of the argument
followed by a pointer to where the value should be stored."
".. the returned values are constant; do not free them. They point into
the DBusMessage."
[1] http://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#gad8953f53ceea7de81cde792e3edd0230
Signed-off-by: Andrey Mazo <mazo@telum.ru>
Diffstat (limited to 'libgps_dbus.c')
-rw-r--r-- | libgps_dbus.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libgps_dbus.c b/libgps_dbus.c index b22cac84..826f12d4 100644 --- a/libgps_dbus.c +++ b/libgps_dbus.c @@ -33,13 +33,13 @@ struct privdata_t */ static struct gps_data_t *share_gpsdata; static DBusConnection *connection; -static char gpsd_devname[BUFSIZ]; static DBusHandlerResult handle_gps_fix(DBusMessage * message) { DBusError error; /* this packet format was designed before we split eph */ double eph; + const char *gpsd_devname = NULL; dbus_error_init(&error); |