1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-11-03 17:27:29 -05:00

Keep Coverity Scan happy

Coverity Scan (https://scan.coverity.com/projects/trader) complains that
a high-impact defect is present in the scramble() function: "String not
null terminated" -- even though b64encode() does give a NUL-termininated
buffer.
This commit is contained in:
John Zaitseff 2022-08-01 22:27:56 +10:00
parent e3d5d04774
commit 30bfcd167a

View File

@ -929,6 +929,7 @@ char *scramble (char *restrict dest, const char *restrict src,
// Place checksum in front of Base64 string
snprintf(chksumbuf, SCRAMBLE_CHKSUM_LEN + 1, "%03x", chksum);
memcpy(dest, chksumbuf, SCRAMBLE_CHKSUM_LEN);
dest[size - 1] = '\0'; // Keep Coverity Scan happy...
free(xorbuf);
}