[Pkg-gnupg-commit] [gnupg2] 66/160: gpgscm: Fix buffer overflow.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 15 09:36:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch upstream
in repository gnupg2.

commit 56cebdc30c10eaec179a6911e308074264d876ae
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jun 28 18:08:01 2016 +0200

    gpgscm: Fix buffer overflow.
    
    * tests/gpgscm/scheme.c (store_string): Avoid writing past allocated
    buffer.
    
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 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 486194c..aabf400 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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list