summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-09-27 15:07:04 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-10-10 18:09:00 +0200
commit98b4762ca9707156102ba075c089acc659d60fbb (patch)
treed0feafbd6e85089aec91eb3774d35c08bcd7dfcf
parent4de462da4d029aff330966e4158e1bffaeb743fd (diff)
downloadgnutls-98b4762ca9707156102ba075c089acc659d60fbb.tar.gz
str: use assert to mark impossible cases
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r--lib/str.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/str.c b/lib/str.c
index 9c3503224d..dc131818a3 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -99,6 +99,7 @@ void _gnutls_buffer_clear(gnutls_buffer_st * str)
static void align_allocd_with_data(gnutls_buffer_st * dest)
{
assert(dest->allocd != NULL);
+ assert(dest->data != NULL);
if (dest->length)
memmove(dest->allocd, dest->data, dest->length);
dest->data = dest->allocd;
@@ -154,6 +155,7 @@ gnutls_buffer_append_data(gnutls_buffer_t dest, const void *data,
align_allocd_with_data(dest);
}
+ assert(dest->data != NULL);
memcpy(&dest->data[dest->length], data, data_size);
dest->length = tot_len;