gpgscm: Fix buffer overflow.
authorJustus Winter <justus@g10code.com>
Tue, 28 Jun 2016 16:08:01 +0000 (18:08 +0200)
committerJustus Winter <justus@g10code.com>
Tue, 28 Jun 2016 16:21:50 +0000 (18:21 +0200)
* tests/gpgscm/scheme.c (store_string): Avoid writing past allocated
buffer.

Signed-off-by: Justus Winter <justus@g10code.com>
tests/gpgscm/scheme.c

index 486194c..aabf400 100644 (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;