File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -625,11 +625,18 @@ static void _emit_error(const char *format, ...)
625625 char * msg = NULL ;
626626 bool free_msg = false;
627627 if (len >= (int )sizeof (buf )) {
628- msg = safe_emalloc (len + 1 , 1 , 0 );
629- vsnprintf (msg , len + 1 , format , args2 );
630- free_msg = true;
631- } else {
628+ msg = safe_emalloc (len , 1 , 0 );
629+ if (vsnprintf (msg , len + 1 , format , args2 ) < 0 ) {
630+ char default_msg [] = "Datadog blocked the request." ;
631+ msg = default_msg ;
632+ } else {
633+ free_msg = true;
634+ }
635+ } else if (len >= 0 ) {
632636 msg = buf ;
637+ } else {
638+ char default_msg [] = "Datadog blocked the request." ;
639+ msg = default_msg ;
633640 }
634641 va_end (args2 );
635642 va_end (args );
@@ -661,6 +668,9 @@ static void _emit_error(const char *format, ...)
661668#ifdef FRANKENPHP_SUPPORT
662669 if (strcmp (sapi_module .name , "frankenphp" ) == 0 ) {
663670 _php_verror (E_WARNING , "%s" , msg );
671+ if (free_msg ) {
672+ efree (msg );
673+ }
664674 _prepare_req_init_block ();
665675 return ;
666676 }
You can’t perform that action at this time.
0 commit comments