badwords: catch and fix more variants of NN-bit

Closes #20304
This commit is contained in:
Viktor Szakats
2026-01-11 14:50:27 +01:00
parent 60ab58a8a5
commit 4651d4c76b
20 changed files with 29 additions and 32 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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;

View File

@@ -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");

View File

@@ -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)
{

View File

@@ -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] */

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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 =

View File

@@ -20,7 +20,7 @@ Mime
smtp
</server>
<name>
SMTP multipart with 7bit encoder error
SMTP multipart with 7-bit encoder error
</name>
<stdin crlf="yes">
From: different

View File

@@ -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;

View File

@@ -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|"
},