summaryrefslogtreecommitdiff
path: root/lib/str.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2017-02-20 14:03:40 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-02-20 18:52:17 +0100
commit944638f77c919baa4c06c8c2ced99dd3e2821514 (patch)
tree419003815e5f25ca818fbbdd26bac1161880084d /lib/str.c
parentaa78a8c916d62a92d36be861e0433f00452688aa (diff)
downloadgnutls-944638f77c919baa4c06c8c2ced99dd3e2821514.tar.gz
eliminated various clang warnings with non-null arguments
That is, use assert() to ensure that known to be non-null variables will be used as input to functions requiring non-null. Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
Diffstat (limited to 'lib/str.c')
-rw-r--r--lib/str.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/str.c b/lib/str.c
index 4a72a2f27f..647b03c836 100644
--- a/lib/str.c
+++ b/lib/str.c
@@ -110,6 +110,7 @@ void _gnutls_buffer_clear(gnutls_buffer_st * str)
static void align_allocd_with_data(gnutls_buffer_st * dest)
{
+ assert(dest->allocd != NULL);
if (dest->length)
memmove(dest->allocd, dest->data, dest->length);
dest->data = dest->allocd;
@@ -344,6 +345,8 @@ _gnutls_buffer_insert_data(gnutls_buffer_st * dest, int pos,
if (ret < 0)
return ret;
+ assert(dest->data != NULL);
+
memmove(&dest->data[pos + str_size], &dest->data[pos],
orig_length - pos);