Quellcode durchsuchen

_inst being NULL is the same in this contect as _inst->len being 0.
Handle the latter and don't do zero-memory allocation and zero-bytes
memcpy().

Sponsored by: Sippy Software, Inc.
Debugging: mpatrol

Maxim Sobolev vor 17 Jahren
Ursprung
Commit
966ec72c44
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      modules_s/usrloc/ucontact.c

+ 1 - 1
modules_s/usrloc/ucontact.c

@@ -118,7 +118,7 @@ int new_ucontact(str* _dom, str* _uid, str* aor, str* _contact, time_t _e, qvalu
 		(*_c)->received.len = 0;
 	}
 
-	if(_inst) {
+	if(_inst && _inst->len > 0) {
 		(*_c)->instance.s = (char*)shm_malloc(_inst->len);
 		if ((*_c)->instance.s == 0) {
 			LOG(L_ERR, "new_ucontact(): No memory left\n");