[Pkg-privacy-commits] [libotr] 90/225: Don't call memmove with NULL args, even if the length is 0

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:45:01 UTC 2015


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

infinity0 pushed a commit to branch master
in repository libotr.

commit c52fb15c2912ce0008481a012abf7c7ea5a5d930
Author: Ian Goldberg <iang at cs.uwaterloo.ca>
Date:   Thu Jul 19 10:47:05 2012 -0400

    Don't call memmove with NULL args, even if the length is 0
    
    Thanks to Paul Wouters <paul at cypherpunks.ca> for the report.
---
 toolkit/parse.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/toolkit/parse.c b/toolkit/parse.c
index fac75d6..aaa0ad5 100644
--- a/toolkit/parse.c
+++ b/toolkit/parse.c
@@ -100,9 +100,11 @@ static unsigned char *decode(const char *msg, size_t *lenp)
 	bufp += mpilen; lenp -= mpilen; \
     } while(0)
 #define read_raw(b, l) do { \
-	require_len(l); \
-	memmove((b), bufp, (l)); \
-	bufp += (l); lenp -= (l); \
+	if (l) { \
+	  require_len(l); \
+	  memmove((b), bufp, (l)); \
+	  bufp += (l); lenp -= (l); \
+	} \
     } while(0)
 #define write_int(x) do { \
 	bufp[0] = ((x) >> 24) & 0xff; \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libotr.git



More information about the Pkg-privacy-commits mailing list