From 0096284a8ef292012f2feab67db460057be6ad39 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Tue, 9 Jan 2018 09:03:26 +0100 Subject: 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 --- core/uemis.c | 5 ++--- 1 file 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)); -- cgit v1.2.3-70-g09d2