]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11785 [esl] dead assignments in esl_event_serialize
authorChris Rienzo <chris@signalwire.com>
Tue, 16 Apr 2019 02:51:54 +0000 (22:51 -0400)
committerAndrey Volk <andywolk@gmail.com>
Wed, 17 Jul 2019 16:22:11 +0000 (20:22 +0400)
               null attribute in esl_buffer_read
       null attribute in esl_event_base_add_header
       null attribute in esl_recv_event

libs/esl/src/esl.c
libs/esl/src/esl_buffer.c
libs/esl/src/esl_event.c

index 923ae966f4646b60b58d5f845a140cbf4fee252f..01a27f490ea5fcf008bf771562481a7bae4f8b66 100644 (file)
@@ -1459,7 +1459,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
                                        }
                                }
                        
-                               if ((cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
+                               if (beg && (cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
                                        handle->last_ievent->body = strdup(beg);
                                }
                        
index 6095a56a21d789f89f33747499be393d3dde16db..ac4247791b71c66a06b3c7a0343c7be8d51c4aa7 100644 (file)
@@ -176,6 +176,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_si
 
        esl_assert(buffer != NULL);
        esl_assert(data != NULL);
+       esl_assert(buffer->head != NULL);
 
 
        if (buffer->used < 1) {
index ae01575251bcb4e4c129f0761f7c440a673380a9..75a456c86150623f576558d556a36c350c4a90f7 100644 (file)
@@ -549,6 +549,7 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
        redraw:
                len = 0;
                for(j = 0; j < header->idx; j++) {
+                       esl_assert(header->array[j]);
                        len += strlen(header->array[j]) + 2;
                }
 
@@ -835,12 +836,10 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
 
                if ((len + llen) > dlen) {
                        char *m;
-                       char *old = buf;
                        dlen += (blocksize + (len + llen));
                        if ((m = realloc(buf, dlen))) {
                                buf = m;
                        } else {
-                               buf = old;
                                abort();
                        }
                }
@@ -864,12 +863,10 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
 
                if ((len + llen) > dlen) {
                        char *m;
-                       char *old = buf;
                        dlen += (blocksize + (len + llen));
                        if ((m = realloc(buf, dlen))) {
                                buf = m;
                        } else {
-                               buf = old;
                                abort();
                        }
                }