1
0
forked from aniani/gmnisrv

Use strncpy to build TLS_CLIENT_HASH

strncat on an uninitialized array leads to issues.
This commit is contained in:
dece 2021-06-17 13:25:25 +02:00 committed by Drew DeVault
parent b9a92193e9
commit 0bf3cde2a0

View File

@ -215,7 +215,7 @@ serve_cgi(struct gmnisrv_client *client, const char *path,
// +7 for "SHA256:" prefix
// +1 for null char
char hex_digest[32*2 + 7 + 1];
strncat(hex_digest, "SHA256:", 8);
strncpy(hex_digest, "SHA256:", 8);
char *cur_pos = hex_digest + 7;
for (int i = 0; i < 32; ++i) {