1- #include <ctype.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
2- #include <errno.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
3- #include <ev.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
4- #include <math.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
5- #include <netinet/in.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
1+ #include <ctype.h>
2+ #include <errno.h>
3+ #include <ev.h>
4+ #include <math.h>
5+ #include <netinet/in.h>
66#include <stdint.h>
7- #include <stdio.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
8- #include <string.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
9- #include <sys/socket.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
10- #include <unistd.h> // NOLINT(llvmlibc-restrict-system-libc-headers)
7+ #include <stdio.h>
8+ #include <string.h>
9+ #include <sys/socket.h>
10+ #include <unistd.h>
1111
1212#include "https_client.h"
1313#include "logging.h"
@@ -69,7 +69,6 @@ static size_t write_buffer(void *buf, size_t size, size_t nmemb, void *userp) {
6969 return 0 ;
7070 }
7171 ctx -> buf = new_buf ;
72- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
7372 memcpy (& (ctx -> buf [ctx -> buflen ]), buf , write_size );
7473 ctx -> buflen = new_size ;
7574 // We always expect to receive valid non-null ASCII but just to be safe...
@@ -153,21 +152,16 @@ static void https_log_data(int level, struct https_fetch_ctx *ctx,
153152 char str [width + 1 ];
154153 size_t hex_off = 0 ;
155154 size_t str_off = 0 ;
156- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
157155 memset (hex , 0 , sizeof (hex ));
158- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
159156 memset (str , 0 , sizeof (str ));
160157
161158 for (size_t c = 0 ; c < width ; c ++ ) {
162159 if (i + c < size ) {
163- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
164160 hex_off += (size_t )snprintf (hex + hex_off , sizeof (hex ) - hex_off ,
165161 "%02x " , (unsigned char )ptr [i + c ]);
166- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
167162 str_off += (size_t )snprintf (str + str_off , sizeof (str ) - str_off ,
168163 "%c" , isprint (ptr [i + c ]) ? ptr [i + c ] : '.' );
169164 } else {
170- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
171165 hex_off += (size_t )snprintf (hex + hex_off , sizeof (hex ) - hex_off , " " );
172166 }
173167 }
@@ -313,14 +307,14 @@ static void https_fetch_ctx_init(https_client_t *client,
313307 ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_POSTFIELDS , data );
314308 ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_WRITEFUNCTION , & write_buffer );
315309 ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_WRITEDATA , ctx );
316- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_MAXAGE_CONN , client -> opt -> max_idle_time );
317- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_PIPEWAIT , client -> opt -> use_http_version > 1 );
310+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_MAXAGE_CONN , ( long ) client -> opt -> max_idle_time );
311+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_PIPEWAIT , ( long )( client -> opt -> use_http_version > 1 ) );
318312 ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_USERAGENT , "https_dns_proxy/0.4" );
319- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_FOLLOWLOCATION , 0 );
320- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_NOSIGNAL , 0 );
321- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_TIMEOUT , client -> connections > 0 ? 5 : 10 /* seconds */ );
313+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_FOLLOWLOCATION , 0L );
314+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_NOSIGNAL , 0L );
315+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_TIMEOUT , client -> connections > 0 ? 5L : 10L /* seconds */ );
322316 // We know Google supports this, so force it.
323- ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_SSLVERSION , CURL_SSLVERSION_TLSv1_2 );
317+ ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_SSLVERSION , ( long ) CURL_SSLVERSION_TLSv1_2 );
324318 ASSERT_CURL_EASY_SETOPT (ctx , CURLOPT_ERRORBUFFER , ctx -> curl_errbuf ); // zeroed by calloc
325319 if (client -> opt -> curl_proxy ) {
326320 DLOG_REQ ("Using curl proxy: %s" , client -> opt -> curl_proxy );
@@ -639,7 +633,6 @@ static int multi_sock_cb(CURL *curl, curl_socket_t sock, int what,
639633 return -1 ;
640634 }
641635 DLOG ("Reserved new io event: %p" , io_event_ptr );
642- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
643636 ev_io_init (io_event_ptr , sock_cb , sock ,
644637 ((what & CURL_POLL_IN ) ? EV_READ : 0 ) |
645638 ((what & CURL_POLL_OUT ) ? EV_WRITE : 0 ));
@@ -652,7 +645,6 @@ static int multi_timer_cb(CURLM __attribute__((unused)) *multi,
652645 GET_PTR (https_client_t , c , userp );
653646 ev_timer_stop (c -> loop , & c -> timer );
654647 if (timeout_ms >= 0 ) {
655- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
656648 ev_timer_init (& c -> timer , timer_cb , (double )timeout_ms / 1000.0 , 0 );
657649 ev_timer_start (c -> loop , & c -> timer );
658650 }
@@ -681,7 +673,6 @@ static void reset_timer_cb(struct ev_loop __attribute__((unused)) *loop,
681673
682674void https_client_init (https_client_t * c , options_t * opt ,
683675 stat_t * stat , struct ev_loop * loop ) {
684- // NOLINTNEXTLINE(clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling)
685676 memset (c , 0 , sizeof (* c ));
686677 c -> loop = loop ;
687678 c -> fetches = NULL ;
0 commit comments