Browse code

core: parse identityinfo - log message on end of buffer

Daniel-Constantin Mierla authored on 20/09/2021 05:22:57
Showing 1 changed files
... ...
@@ -311,8 +311,12 @@ void parse_identityinfo(char *buffer, char *end, struct identityinfo_body *ii_b)
311 311
 	return ;
312 312
 
313 313
 parseerror:
314
-	LM_ERR("unexpected char [%c] in status %d: <<%.*s>> .\n",
315
-			*p,status, (int)(p-buffer), ZSW(p));
314
+	if(p<end) {
315
+		LM_ERR("unexpected char [%c] in status %d: <<%.*s>> .\n",
316
+				*p, status, (int)(p-buffer), ZSW(p));
317
+	} else {
318
+		LM_ERR("unexpected end of buffer - status %d\n", status);
319
+	}
316 320
 	return ;
317 321
 }
318 322