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:
parent
c57501cc5f
commit
56cebdc30c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user