]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
server_name: Return the actual required buffer size if the buffer is too small
authorMartin Storsjo <martin@martin.st>
Wed, 31 Oct 2012 13:44:35 +0000 (15:44 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 31 Oct 2012 17:35:44 +0000 (18:35 +0100)
Since we require space for the null termination, include this in
the info returned if the caller provided a too small buffer.
Otherwise, if the caller allocated a buffer of exactly the suggested
size, it would still be too small.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/ext/server_name.c

index 005d80b948754d48ae6cf65dcd8857e1eeba8a5e..520b69f5205b33e5a55b57544808a13078dcdc76 100644 (file)
@@ -322,7 +322,7 @@ gnutls_server_name_get (gnutls_session_t session, void *data,
     }
   else
     {
-      *data_length = priv->server_names[indx].name_length;
+      *data_length = priv->server_names[indx].name_length + 1;
       return GNUTLS_E_SHORT_MEMORY_BUFFER;
     }