1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-11-10 21:38:50 +01:00

gpgscm: Fix buffer overflow.

* tests/gpgscm/scheme.c (store_string): Avoid writing past allocated
buffer.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-06-28 18:08:01 +02:00
parent c57501cc5f
commit 56cebdc30c

View File

@ -1026,7 +1026,8 @@ static char *store_string(scheme *sc, int len_str, const char *str, char fill) {
return sc->strbuff;
}
if(str!=0) {
snprintf(q, len_str+1, "%s", str);
memcpy (q, str, len_str);
q[len_str]=0;
} else {
memset(q, fill, len_str);
q[len_str]=0;