diff options
author | Anton Babushkin <anton.babushkin@me.com> | 2014-06-09 16:09:03 +0200 |
---|---|---|
committer | Anton Babushkin <anton.babushkin@me.com> | 2014-06-09 16:09:03 +0200 |
commit | 4ad435b483510158ea8a5b303cd680f9e982df84 (patch) | |
tree | ffe51c05754e5640c45b76117c5c8b41d8567bef /src | |
parent | a6cf04a6ff623b7d39a97c70f837198b6c064f5b (diff) | |
download | px4-firmware-4ad435b483510158ea8a5b303cd680f9e982df84.tar.gz px4-firmware-4ad435b483510158ea8a5b303cd680f9e982df84.tar.bz2 px4-firmware-4ad435b483510158ea8a5b303cd680f9e982df84.zip |
dataman: allow writing empty items with nullptr pointer to data
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/dataman/dataman.c | 4 | ||||
-rw-r--r-- | src/modules/dataman/dataman.h | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/modules/dataman/dataman.c b/src/modules/dataman/dataman.c index 96dc98f2a..14fee7c9a 100644 --- a/src/modules/dataman/dataman.c +++ b/src/modules/dataman/dataman.c @@ -324,7 +324,9 @@ _write(dm_item_t item, unsigned char index, dm_persitence_t persistence, const v buffer[1] = persistence; buffer[2] = 0; buffer[3] = 0; - memcpy(buffer + DM_SECTOR_HDR_SIZE, buf, count); + if (count > 0) { + memcpy(buffer + DM_SECTOR_HDR_SIZE, buf, count); + } count += DM_SECTOR_HDR_SIZE; len = -1; diff --git a/src/modules/dataman/dataman.h b/src/modules/dataman/dataman.h index f2b6cd4d3..b25a2a5ef 100644 --- a/src/modules/dataman/dataman.h +++ b/src/modules/dataman/dataman.h @@ -133,7 +133,7 @@ extern "C" { in this header, but till I find it a better home here it is */ typedef struct { - char current_offboard_waypoint_id; /* the index of the active offboard waypoint data */ + char offboard_waypoint_id; /* the index of the active offboard waypoint data */ /* (DM_KEY_WAYPOINTS_OFFBOARD_n) or -1 for none */ } persistent_system_state_t; |