Fix stupid off by one error in Uemis downloader

We are accessing offset 24 in an array of length 24. To make things easier
for the base64 conversion we just treat this as an off by three error and
instead create an array large enough for 27 elements and convert a
sufficient number of base64 chars to initialize all of them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-11-19 20:02:34 -08:00
parent 2a78f3436c
commit f3d87a2b16

View file

@ -380,7 +380,7 @@ static void buffer_insert(char **buffer, int *buffer_size, char *buf)
int obj_dive;
int obj_log;
int offset, len;
uint8_t hdr[24];
uint8_t hdr[27];
/* since we want to insert into the buffer... if there's
* nothing there, this makes absolutely no sense so just
@ -406,7 +406,7 @@ static void buffer_insert(char **buffer, int *buffer_size, char *buf)
* some info from that in order to make sense of the data in
* the dive info */
b64 = strstr(ptr, "<bin>") + 5;
decode(b64, hdr, 32);
decode(b64, hdr, 36);
cbuf = convert_dive_details(buf, hdr);
offset = ptr - *buffer;
len = strlen(cbuf);