From 56cebdc30c10eaec179a6911e308074264d876ae Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 28 Jun 2016 18:08:01 +0200 Subject: [PATCH] gpgscm: Fix buffer overflow. * tests/gpgscm/scheme.c (store_string): Avoid writing past allocated buffer. Signed-off-by: Justus Winter --- tests/gpgscm/scheme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 486194c19..aabf4008e 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -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;