From: Viktor Szakats Date: Sun, 11 Jan 2026 13:50:27 +0000 (+0100) Subject: badwords: catch and fix more variants of `NN-bit` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4651d4c76b2e2cddbf1f28cd2efe81a22a79262c;p=thirdparty%2Fcurl.git badwords: catch and fix more variants of `NN-bit` Closes #20304 --- diff --git a/.github/scripts/badwords.txt b/.github/scripts/badwords.txt index 38c61eb283..a3eeb9c444 100644 --- a/.github/scripts/badwords.txt +++ b/.github/scripts/badwords.txt @@ -78,12 +78,9 @@ file names\b:filenames \buser names\b:usernames \bpass phrase:passphrase \bwill\b:rewrite to present tense -\b32bit:32-bit -\b64bit:64-bit -32 bit\b:32-bit -64 bit\b:64-bit -64-bits:64 bits or 64-bit -32-bits:32 bits or 32-bit +\b[0-9]+bit[^*"'%,]: NN-bit +\b([02-9]|[1-9][0-9]+) bit\b: NN-bit +[0-9]+-bits:NN bits or NN-bit \bvery\b:rephrase using an alternative word \bCurl\b=curl \bcURL\b=curl diff --git a/docs/SSL-PROBLEMS.md b/docs/SSL-PROBLEMS.md index 301ce7e870..0403bd4520 100644 --- a/docs/SSL-PROBLEMS.md +++ b/docs/SSL-PROBLEMS.md @@ -62,7 +62,7 @@ SPDX-License-Identifier: curl to use to allow the server to use a weak cipher for you. Note that these weak ciphers are identified as flawed. For example, this - includes symmetric ciphers with less than 128 bit keys and RC4. + includes symmetric ciphers with less than 128-bit keys and RC4. Schannel in Windows XP is not able to connect to servers that no longer support the legacy handshakes and algorithms used by those versions, so we diff --git a/docs/libcurl/curl_version_info.md b/docs/libcurl/curl_version_info.md index 3620f60ca6..b9c4d4748b 100644 --- a/docs/libcurl/curl_version_info.md +++ b/docs/libcurl/curl_version_info.md @@ -118,7 +118,7 @@ that you have a matching struct for in the header, as you tell libcurl your *version* is just an ASCII string for the libcurl version. -*version_num* is a 24 bit number created like this: \<8 bits major number\> | +*version_num* is a 24-bit number created like this: \<8 bits major number\> | \<8 bits minor number\> | \<8 bits patch number\>. Version 7.9.8 is therefore returned as 0x070908. diff --git a/docs/libcurl/opts/CURLOPT_PORT.md b/docs/libcurl/opts/CURLOPT_PORT.md index c0cf765dba..cd18a24f8c 100644 --- a/docs/libcurl/opts/CURLOPT_PORT.md +++ b/docs/libcurl/opts/CURLOPT_PORT.md @@ -37,7 +37,7 @@ protocol. Usually, you just let the URL decide which port to use but this allows the application to override that. -While this option accepts a 'long', a port number is an unsigned 16 bit number +While this option accepts a 'long', a port number is an unsigned 16-bit number and therefore using a port number lower than zero or over 65535 causes a **CURLE_BAD_FUNCTION_ARGUMENT** error. diff --git a/docs/libcurl/opts/CURLOPT_PROXYPORT.md b/docs/libcurl/opts/CURLOPT_PROXYPORT.md index 6a390ae903..faab053f59 100644 --- a/docs/libcurl/opts/CURLOPT_PROXYPORT.md +++ b/docs/libcurl/opts/CURLOPT_PROXYPORT.md @@ -38,7 +38,7 @@ Disabling this option, setting it to zero, makes it not specified which makes libcurl use the default proxy port number or the port number specified in the proxy URL string. -While this accepts a 'long', the port number is 16 bit so it cannot be larger +While this accepts a 'long', the port number is 16-bit so it cannot be larger than 65535. # DEFAULT diff --git a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md index 5dfb2ff1d2..0f66f31f12 100644 --- a/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md +++ b/docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md @@ -31,7 +31,7 @@ CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, # DESCRIPTION Pass a char pointer pointing to a string containing 32 hexadecimal digits. The -string should be the 128 bit MD5 checksum of the remote host's public key, and +string should be the 128-bit MD5 checksum of the remote host's public key, and libcurl aborts the connection to the host unless the MD5 checksum match. MD5 is a weak algorithm. We strongly recommend using diff --git a/include/curl/curl.h b/include/curl/curl.h index e755f098f2..717bf1e7ff 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -2704,7 +2704,7 @@ CURL_EXTERN char *curl_escape(const char *string, * * DESCRIPTION * - * Unescapes URL encoding in strings (converts all %XX codes to their 8bit + * Unescapes URL encoding in strings (converts all %XX codes to their 8-bit * versions). This function returns a new allocated string or NULL if an error * occurred. * Conversion Note: On non-ASCII platforms the ASCII %XX codes are diff --git a/lib/arpa_telnet.h b/lib/arpa_telnet.h index daf2487fc6..119b33bb39 100644 --- a/lib/arpa_telnet.h +++ b/lib/arpa_telnet.h @@ -27,7 +27,7 @@ /* * Telnet option defines. Add more here if in need. */ -#define CURL_TELOPT_BINARY 0 /* binary 8bit data */ +#define CURL_TELOPT_BINARY 0 /* binary 8-bit data */ #define CURL_TELOPT_ECHO 1 /* just echo! */ #define CURL_TELOPT_SGA 3 /* Suppress Go Ahead */ #define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */ diff --git a/lib/curlx/inet_ntop.c b/lib/curlx/inet_ntop.c index 6bea5e1db6..0b10e8a7f6 100644 --- a/lib/curlx/inet_ntop.c +++ b/lib/curlx/inet_ntop.c @@ -166,7 +166,7 @@ static char *inet_ntop6(const unsigned char *src, char *dst, size_t size) static const unsigned char ldigits[] = "0123456789abcdef"; unsigned int w = words[i]; - /* output lowercase 16bit hex number but ignore leading zeroes */ + /* output lowercase 16-bit hex number but ignore leading zeroes */ if(w & 0xf000) *tp++ = ldigits[(w & 0xf000) >> 12]; if(w & 0xff00) diff --git a/lib/doh.c b/lib/doh.c index 9052fab26b..015a071343 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -113,7 +113,7 @@ UNITTEST DOHcode doh_req_encode(const char *host, if(len < expected_len) return DOH_TOO_SMALL_BUFFER; - *dnsp++ = 0; /* 16 bit id */ + *dnsp++ = 0; /* 16-bit id */ *dnsp++ = 0; *dnsp++ = 0x01; /* |QR| Opcode |AA|TC|RD| Set the RD bit */ *dnsp++ = '\0'; /* |RA| Z | RCODE | */ @@ -152,10 +152,10 @@ UNITTEST DOHcode doh_req_encode(const char *host, *dnsp++ = 0; /* append zero-length label for root */ /* There are assigned TYPE codes beyond 255: use range [1..65535] */ - *dnsp++ = (unsigned char)(255 & (dnstype >> 8)); /* upper 8 bit TYPE */ - *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8 bit TYPE */ + *dnsp++ = (unsigned char)(255 & (dnstype >> 8)); /* upper 8-bit TYPE */ + *dnsp++ = (unsigned char)(255 & dnstype); /* lower 8-bit TYPE */ - *dnsp++ = '\0'; /* upper 8 bit CLASS */ + *dnsp++ = '\0'; /* upper 8-bit CLASS */ *dnsp++ = DNS_CLASS_IN; /* IN - "the Internet" */ *olen = dnsp - orig; diff --git a/lib/ftp.c b/lib/ftp.c index 0197d6c3de..b4e07106cb 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1154,7 +1154,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, break; /* check if port is the maximum value here, because it might be 0xffff and - then the increment below will wrap the 16 bit counter */ + then the increment below will wrap the 16-bit counter */ if(port == port_max) { /* maybe all ports were in use already */ failf(data, "bind() failed, ran out of ports"); diff --git a/lib/mime.c b/lib/mime.c index fe48107be5..493924a567 100644 --- a/lib/mime.c +++ b/lib/mime.c @@ -357,7 +357,7 @@ static void cleanup_encoder_state(struct mime_encoder_state *p) p->bufend = 0; } -/* Dummy encoder. This is used for 8bit and binary content encodings. */ +/* Dummy encoder. This is used for 8-bit and binary content encodings. */ static size_t encoder_nop_read(char *buffer, size_t size, bool ateof, struct curl_mimepart *part) { @@ -384,7 +384,7 @@ static curl_off_t encoder_nop_size(curl_mimepart *part) return part->datasize; } -/* 7bit encoder: the encoder is just a data validity check. */ +/* 7-bit encoder: the encoder is just a data validity check. */ static size_t encoder_7bit_read(char *buffer, size_t size, bool ateof, curl_mimepart *part) { diff --git a/lib/sha256.c b/lib/sha256.c index 9f31202cca..764e5cf16a 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -297,7 +297,7 @@ static const unsigned long K[64] = { #define Gamma0(x) (Sha256_S(x, 7) ^ Sha256_S(x, 18) ^ Sha256_R(x, 3)) #define Gamma1(x) (Sha256_S(x, 17) ^ Sha256_S(x, 19) ^ Sha256_R(x, 10)) -/* Compress 512-bits */ +/* Compress 512 bits */ static int sha256_compress(struct sha256_state *md, const unsigned char *buf) { unsigned long S[8], W[64]; @@ -307,7 +307,7 @@ static int sha256_compress(struct sha256_state *md, const unsigned char *buf) for(i = 0; i < 8; i++) { S[i] = md->state[i]; } - /* copy the state into 512-bits into W[0..15] */ + /* copy the state into 512 bits into W[0..15] */ for(i = 0; i < 16; i++) W[i] = WPA_GET_BE32(buf + (4 * i)); /* fill W[16..63] */ diff --git a/lib/socks_gssapi.c b/lib/socks_gssapi.c index 2da11713eb..579ae71b9a 100644 --- a/lib/socks_gssapi.c +++ b/lib/socks_gssapi.c @@ -188,7 +188,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, } if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_init_sec_context") || - /* the size needs to fit in a 16 bit field */ + /* the size needs to fit in a 16-bit field */ (gss_send_token.length > 0xffff)) { gss_release_name(&gss_status, &server); gss_release_buffer(&gss_status, &gss_send_token); diff --git a/lib/socks_sspi.c b/lib/socks_sspi.c index 0f3cfceb27..ba7965391c 100644 --- a/lib/socks_sspi.c +++ b/lib/socks_sspi.c @@ -188,7 +188,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, socksreq[0] = 1; /* GSS-API subnegotiation version */ socksreq[1] = 1; /* authentication message type */ if(sspi_send_token.cbBuffer > 0xffff) { - /* needs to fit in an unsigned 16 bit field */ + /* needs to fit in an unsigned 16-bit field */ result = CURLE_COULDNT_CONNECT; goto error; } @@ -399,7 +399,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf, etbuf_size = sspi_w_token[0].cbBuffer + sspi_w_token[1].cbBuffer + sspi_w_token[2].cbBuffer; if(etbuf_size > 0xffff) { - /* needs to fit in an unsigned 16 bit field */ + /* needs to fit in an unsigned 16-bit field */ result = CURLE_COULDNT_CONNECT; goto error; } diff --git a/lib/tftp.c b/lib/tftp.c index 634f3006f0..584d146a30 100644 --- a/lib/tftp.c +++ b/lib/tftp.c @@ -340,7 +340,7 @@ static CURLcode tftp_option_add(struct tftp_conn *state, size_t *csize, return CURLE_OK; } -/* the next blocknum is x + 1 but it needs to wrap at an unsigned 16bit +/* the next blocknum is x + 1 but it needs to wrap at an unsigned 16-bit boundary */ #define NEXT_BLOCKNUM(x) (((x) + 1) & 0xffff) diff --git a/lib/ws.c b/lib/ws.c index 37cacae966..ff6557a222 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -445,7 +445,7 @@ static CURLcode ws_dec_read_head(struct ws_decoder *dec, break; case 10: if(dec->head[2] > 127) { - failf(data, "[WS] frame length longer than 63 bit not supported"); + failf(data, "[WS] frame length longer than 63 bits not supported"); return CURLE_RECV_ERROR; } dec->payload_len = diff --git a/tests/data/test649 b/tests/data/test649 index e6457bec25..076cced170 100644 --- a/tests/data/test649 +++ b/tests/data/test649 @@ -20,7 +20,7 @@ Mime smtp -SMTP multipart with 7bit encoder error +SMTP multipart with 7-bit encoder error From: different diff --git a/tests/runtests.pl b/tests/runtests.pl index c5314099c2..e8297137c1 100755 --- a/tests/runtests.pl +++ b/tests/runtests.pl @@ -2633,7 +2633,7 @@ if(!$randseed) { close($curlvh) || die "could not get curl version!"; # use the first line of output and get the md5 out of it my $str = md5($c[0]); - $randseed += unpack('S', $str); # unsigned 16 bit value + $randseed += unpack('S', $str); # unsigned 16-bit value } srand $randseed; diff --git a/tests/unit/unit1658.c b/tests/unit/unit1658.c index d879ea5b79..114a626c6a 100644 --- a/tests/unit/unit1658.c +++ b/tests/unit/unit1658.c @@ -342,7 +342,7 @@ static CURLcode test_unit1658(const char *arg) "h2" "\x00\x03" /* RR (3 == PORT) */ "\x00\x03" /* data size */ - "\x12\x34\x00", /* 24 bit port number! */ + "\x12\x34\x00", /* 24-bit port number */ 17, "r:43|" }, @@ -356,7 +356,7 @@ static CURLcode test_unit1658(const char *arg) "h2" "\x00\x03" /* RR (3 == PORT) */ "\x00\x01" /* data size */ - "\x12", /* 8 bit port number! */ + "\x12", /* 8-bit port number */ 15, "r:43|" },