2025-01-25 11:14 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* contrib/hbcurl/core.c
    ! declare buffer for CURLOPT_ERRORBUFFER as 'char *' instead of
      'unsigned char *', the exact buffer type is chcked in typecheck-gcc.h
      and 'unsigned char *' does not pass this test
    ; QUESTION:
      Why curl_easy_setopt( <pCurl>, HB_CURLOPT_ER_BUFF_SETUP, [<nBufSize>] )
      accepts <nBufSize> parameter?
      Buffer smaller then CURL_ERROR_SIZE means GPF and larger waste of memory.
      The only acceptable value for <nBufSize> is CURL_ERROR_SIZE.
      The allocate buffer should be initialized with '\0' otherwise we will
      have other GPF trap when user call curl_easy_er_buff_get() before any
      error is set. This bug was fixed in CURL 7.60.0.
This commit is contained in:
Przemysław Czerpak
2025-01-25 11:14:38 +01:00
parent 87b5139864
commit d59d6d69db
2 changed files with 18 additions and 4 deletions

View File

@@ -7,6 +7,20 @@
Entries may not always be in chronological/commit order.
See license at the end of file. */
2025-01-25 11:14 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbcurl/core.c
! declare buffer for CURLOPT_ERRORBUFFER as 'char *' instead of
'unsigned char *', the exact buffer type is chcked in typecheck-gcc.h
and 'unsigned char *' does not pass this test
; QUESTION:
Why curl_easy_setopt( <pCurl>, HB_CURLOPT_ER_BUFF_SETUP, [<nBufSize>] )
accepts <nBufSize> parameter?
Buffer smaller then CURL_ERROR_SIZE means GPF and larger waste of memory.
The only acceptable value for <nBufSize> is CURL_ERROR_SIZE.
The allocate buffer should be initialized with '\0' otherwise we will
have other GPF trap when user call curl_easy_er_buff_get() before any
error is set. This bug was fixed in CURL 7.60.0.
2025-01-25 10:19 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* .github/workflows/vm1-ci.yml
* .github/workflows/vm2-ci.yml

View File

@@ -118,8 +118,8 @@ typedef struct _HB_CURL
size_t dl_len;
size_t dl_pos;
unsigned char * er_ptr;
size_t er_len;
char * er_ptr;
size_t er_len;
PHB_ITEM pProgressCallback;
PHB_ITEM pDebugCallback;
@@ -984,7 +984,7 @@ HB_FUNC( CURL_EASY_SETOPT )
case HB_CURLOPT_ER_BUFF_SETUP:
hb_curl_buff_er_free( hb_curl );
hb_curl->er_len = hb_parnldef( 3, HB_CURL_ER_BUFF_SIZE_INIT );
hb_curl->er_ptr = ( unsigned char * ) hb_xgrab( hb_curl->er_len );
hb_curl->er_ptr = ( char * ) hb_xgrab( hb_curl->er_len );
res = curl_easy_setopt( hb_curl->curl, CURLOPT_ERRORBUFFER, hb_curl->er_ptr );
break;
#endif
@@ -2064,7 +2064,7 @@ HB_FUNC( CURL_EASY_ER_BUFF_GET )
PHB_CURL hb_curl = PHB_CURL_par( 1 );
if( hb_curl )
hb_retc( ( char * ) hb_curl->er_ptr );
hb_retc( hb_curl->er_ptr );
else
#endif
hb_retc_null();