aboutsummaryrefslogtreecommitdiffstats
path: root/common/iobuf.c
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2017-03-30 13:44:35 +0000
committerJustus Winter <[email protected]>2017-03-30 14:13:43 +0000
commit214fa9012296d796b78f1a3106d656639cf50aef (patch)
tree76f95a831cbc57ede1cf7fea186450b7231f9666 /common/iobuf.c
parentgpg: Remove the use of the signature information from a KBX. (diff)
downloadgnupg-214fa9012296d796b78f1a3106d656639cf50aef.tar.gz
gnupg-214fa9012296d796b78f1a3106d656639cf50aef.zip
common: Avoid undefined behavior.
* common/iobuf.c (iobuf_read_line): Do not consider 'length' if 'buffer' is NULL. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'common/iobuf.c')
-rw-r--r--common/iobuf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/iobuf.c b/common/iobuf.c
index db66a7f17..5a9fd7caf 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 */