Browse code

xprint: check hdr type HDR_ERROR_T after parsing

Daniel-Constantin Mierla authored on 02/06/2021 16:48:50
Showing 1 changed files
... ...
@@ -1481,16 +1481,17 @@ static int _xl_parse_format(char *s, xl_elog_p *el, int shm, xl_parse_cb parse_c
1481 1481
 				/* ugly hack for compact header names -- !!fake length!!
1482 1482
 				 * -- parse_hname2 expects name buffer length >= 4
1483 1483
 				 */
1484
-				if (parse_hname2(e->hparam.s,
1484
+				parse_hname2(e->hparam.s,
1485 1485
 						e->hparam.s + ((e->hparam.len<4)?4:e->hparam.len),
1486
-						&hdr)==0)
1486
+						&hdr);
1487
+				if(hdr.type==HDR_ERROR_T)
1487 1488
 				{
1488
-					LOG(L_ERR,"xprint: xl_parse_format: strange error\n");
1489
+					LOG(L_ERR,"xprint: xl_parse_format: header parsing error\n");
1489 1490
 					goto error;
1490 1491
 				}
1491 1492
 				e->hparam.len--;
1492 1493
 				e->hparam.s[e->hparam.len] = c;
1493
-				if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T)
1494
+				if (hdr.type!=HDR_OTHER_T)
1494 1495
 				{
1495 1496
 					LOG(L_INFO,"INFO:xprint: xl_parse_format: using "
1496 1497
 						"hdr type (%d) instead of <%.*s>\n",