lib: fix seperator in snprintf_error_data

When multiple error flags are set, snprintf_error_data created a comma
seperated textual presentation of it. Commit ef853f5553 ("added return value
check of snprintf to prevent possible buffer overflows detected by CodeQL")
removed the increment of count, so the delimiter is no longer added. Fix this
by incrementing count again.

Fixes: Commit ef853f5553 ("added return value check of snprintf to prevent possible buffer overflows detected by CodeQL")
Signed-off-by: Jeroen Hofstee <jhofstee@victronenergy.com>
pull/375/head
Jeroen Hofstee 2022-08-17 16:51:43 +02:00
parent f020f563e7
commit 3bb412e072
1 changed files with 1 additions and 0 deletions

1
lib.c
View File

@ -582,6 +582,7 @@ static int snprintf_error_data(char *buf, size_t len, uint8_t err,
return n;
}
n += tmp_n;
count++;
}
}