[Pkg-gnupg-commit] [gnupg2] 97/124: common: Avoid undefined behavior.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed Apr 5 15:55:36 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 214fa9012296d796b78f1a3106d656639cf50aef
Author: Justus Winter <justus at g10code.com>
Date: Thu Mar 30 15:44:35 2017 +0200
common: Avoid undefined behavior.
* common/iobuf.c (iobuf_read_line): Do not consider 'length' if
'buffer' is NULL.
Signed-off-by: Justus Winter <justus at g10code.com>
---
common/iobuf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/iobuf.c b/common/iobuf.c
index db66a7f..5a9fd7c 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -2552,7 +2552,7 @@ iobuf_read_line (iobuf_t a, byte ** addr_of_buffer,
NUL character in the buffer. This requires at least 2 bytes. We
don't complicate the code by handling the stupid corner case, but
simply assert that it can't happen. */
- assert (length >= 2 || maxlen >= 2);
+ assert (!buffer || length >= 2 || maxlen >= 2);
if (!buffer || length <= 1)
/* must allocate a new buffer */
--
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