Browse code

core: parse identityinfo - log message on end of buffer

(cherry picked from commit 1e212088091183aac8fcd418656beea523950870)
(cherry picked from commit 8a6c44d2f0504f81b2ef1d97732499b5f721b4a7)
(cherry picked from commit 81d8e4cfbb991f046ea2123c9dfa431f407aa5f1)

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