]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
badwords: catch and fix more variants of `NN-bit`
authorViktor Szakats <commit@vsz.me>
Sun, 11 Jan 2026 13:50:27 +0000 (14:50 +0100)
committerViktor Szakats <commit@vsz.me>
Wed, 14 Jan 2026 01:35:00 +0000 (02:35 +0100)
Closes #20304

20 files changed:
.github/scripts/badwords.txt
docs/SSL-PROBLEMS.md
docs/libcurl/curl_version_info.md
docs/libcurl/opts/CURLOPT_PORT.md
docs/libcurl/opts/CURLOPT_PROXYPORT.md
docs/libcurl/opts/CURLOPT_SSH_HOST_PUBLIC_KEY_MD5.md
include/curl/curl.h
lib/arpa_telnet.h
lib/curlx/inet_ntop.c
lib/doh.c
lib/ftp.c
lib/mime.c
lib/sha256.c
lib/socks_gssapi.c
lib/socks_sspi.c
lib/tftp.c
lib/ws.c
tests/data/test649
tests/runtests.pl
tests/unit/unit1658.c

index 38c61eb283dc59ee246b98948482cc36783d8be5..a3eeb9c444fb79ca1bc47dab71c2e713a9a95894 100644 (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
index 301ce7e870adfac8a95be6c3f2b7364ae4940871..0403bd4520868317cdebec273e72971b49d12298 100644 (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
index 3620f60ca68b175618f23087013a0b7bf0cda064..b9c4d4748beae53b0c6e76d0a356d8a268889454 100644 (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.
 
index c0cf765dbacffa95013765ca850d6668cc493ba8..cd18a24f8c1834307890a79f43d5d0ebef03febf 100644 (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.
 
index 6a390ae9030edc81443f2532cffb7312583d6b41..faab053f59c7d11c1d2af878031d118a77149d73 100644 (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
index 5dfb2ff1d247a8ffd1da8295e534e2507f1b53b9..0f66f31f12ab067b19dbbb17db572db84c7228d9 100644 (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
index e755f098f2c8e4ad0696555ca35e2bef3404dac7..717bf1e7ff2531a5381cf4b6569caaa8f8d9e489 100644 (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
index daf2487fc616a7df771d15e69a9cf705922b52c8..119b33bb39150244a5a1202b278686e2506deb06 100644 (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 */
index 6bea5e1db6ac852a5ce5746e7510980229c394ce..0b10e8a7f63087853c342313f6fe0e57670dd7f8 100644 (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)
index 9052fab26ba3ea9d5661c8a3f225de36dfc71189..015a071343ad07e8eeba3604d328a8e4eedbee1c 100644 (file)
--- 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;
index 0197d6c3de542ff20faa54c95aec28cefc2d01ef..b4e07106cb560a5a67ca69358438fe14aeeb2ab4 100644 (file)
--- 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");
index fe48107be598bc0e83901ae0810a6252828b8823..493924a567e59ba6693dee49c32f1772dd4d337e 100644 (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)
 {
index 9f31202ccaeabc8025bccfcffeba20c64c85b344..764e5cf16a2cffec8eede45515b23161c85fb805 100644 (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] */
index 2da11713ebd884e9ba0cd7a6a6018a3a362b8b13..579ae71b9a3eedf00ad56a82409d6cbe1aea29bc 100644 (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);
index 0f3cfceb272d8aa2e1ab4df7e20e03c7a4240433..ba7965391c37f9ed1c972614611a9cf64beac633 100644 (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;
     }
index 634f3006f0fef3ef7e3a2946ad8a2ef14ddc5b89..584d146a30ff151ad1fd23ac73bd9a25827b0e51 100644 (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)
 
index 37cacae966d2d64daa066de38685b3c2fcf6205c..ff6557a2229f70f9bc7f6b15a86fd9675d6434cf 100644 (file)
--- 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 =
index e6457bec25c29047e962f5cd764b30d367e5866d..076cced170e9edc2bdc1b613b194dea5c53f2d66 100644 (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
index c5314099c2e3e7924f2f905ac1452a914bcdbac0..e8297137c1e4a4e2da1395daac8c1e2242a5a2ad 100755 (executable)
@@ -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;
 
index d879ea5b79ccd78308c1c278bbd131e678b4159b..114a626c6a016810ed2a7782006d5d8682637c7b 100644 (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|"
     },