diff options
author | Jan Mulder <jlmulder@xs4all.nl> | 2018-01-09 09:03:26 +0100 |
---|---|---|
committer | Jan Mulder <jlmulder@xs4all.nl> | 2018-01-10 16:45:42 +0100 |
commit | 0096284a8ef292012f2feab67db460057be6ad39 (patch) | |
tree | ee03f7140f069c3c68487e1f6e1b8ae66f2589dc | |
parent | 3e2caa468e1740133f60067e9c686cd4149ef063 (diff) | |
download | subsurface-0096284a8ef292012f2feab67db460057be6ad39.tar.gz |
cleanup: fix possbile buffer overrun
No reason to mess around with a 5 byte buffer when we have a
proper buffer available to receive a possibly 8 byte output
based on the format string. And silences compiler warning.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r-- | core/uemis.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/uemis.c b/core/uemis.c index eeb8a79c4..cd7a0c1f1 100644 --- a/core/uemis.c +++ b/core/uemis.c @@ -299,7 +299,6 @@ void uemis_parse_divelog_binary(char *base64, void *datap) struct divecomputer *dc = &dive->dc; int template, gasoffset; uint8_t active = 0; - char version[5]; datalen = uemis_convert_base64(base64, &data); dive->dc.airtemp.mkelvin = C_to_mkelvin((*(uint16_t *)(data + 45)) / 10.0); @@ -374,8 +373,8 @@ void uemis_parse_divelog_binary(char *base64, void *datap) /* get data from the footer */ char buffer[24]; - snprintf(version, sizeof(version), "%1u.%02u", data[18], data[17]); - add_extra_data(dc, "FW Version", version); + snprintf(buffer, sizeof(buffer), "%1u.%02u", data[18], data[17]); + add_extra_data(dc, "FW Version", buffer); snprintf(buffer, sizeof(buffer), "%08x", *(uint32_t *)(data + 9)); add_extra_data(dc, "Serial", buffer); snprintf(buffer, sizeof(buffer), "%d", *(uint16_t *)(data + i + 35)); |