changeset 1172:83d55d26ae80

Hand the case of invalid objects in the msg_dump functions
author Sebastien Decugis <sdecugis@freediameter.net>
date Mon, 03 Jun 2013 10:28:33 +0800
parents 5dab72369dff
children d0a7b76a3c1c
files libfdproto/messages.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libfdproto/messages.c	Mon Jun 03 10:01:31 2013 +0800
+++ b/libfdproto/messages.c	Mon Jun 03 10:28:33 2013 +0800
@@ -736,6 +736,11 @@
 {
 	FD_DUMP_HANDLE_OFFSET();
 		
+	if (!VALIDATE_OBJ(obj)) {
+		CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "INVALID MESSAGE OR AVP @%p"), return NULL);
+		return *buf;
+	}
+	
 	if (force_parsing) {
 		(void) fd_msg_parse_dict(obj, dict, NULL);
 	}
@@ -751,6 +756,9 @@
 
 		default:
 			ASSERT(0);
+			free(*buf):
+			*buf = NULL;
+			return NULL;
 	}
 		
 	if (recurse) {
"Welcome to our mercurial repository"