]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
misc: null-terminate
authorDaniel Stenberg <daniel@haxx.se>
Sat, 17 Sep 2022 15:32:21 +0000 (17:32 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 17 Sep 2022 21:19:29 +0000 (23:19 +0200)
Make use of this term consistently.

Closes #9527

19 files changed:
docs/BUFREF.md
docs/CODE_REVIEW.md
docs/libcurl/curl_easy_header.3
docs/libcurl/curl_easy_option_next.3
docs/libcurl/opts/CURLOPT_POSTFIELDS.3
docs/libcurl/opts/CURLOPT_PREREQFUNCTION.3
include/curl/options.h
lib/base64.c
lib/curl_addrinfo.c
lib/doh.c
lib/dynbuf.h
lib/headers.c
lib/mprintf.c
lib/rand.c
lib/rand.h
lib/vauth/digest.c
lib/vauth/ntlm.c
tests/libtest/lib1911.c
tests/unit/unit1305.c

index 35c534263bed674063247fd1ae5de91baf893f3f..c11c6015122a1ad4e4ee0cffe24092708e2832fa 100644 (file)
@@ -59,8 +59,8 @@ Releases the previously referenced buffer, then duplicates the `length`-byte
 `data` into a buffer allocated via `malloc()` and references the latter
 associated with destructor `curl_free()`.
 
-An additional trailing byte is allocated and set to zero as a possible
-string zero-terminator; it is not counted in the stored length.
+An additional trailing byte is allocated and set to zero as a possible string
+null-terminator; it is not counted in the stored length.
 
 Returns `CURLE_OK` if successful, else `CURLE_OUT_OF_MEMORY`.
 
index 20d1be849dbba24bdc4be522bd506d0abe931d64..33802811710b0a7105b269002cd5f9d64f15a804 100644 (file)
@@ -151,12 +151,12 @@ Maybe use of `realloc()` should rather use the dynbuf functions?
 Do not allow new code that grows buffers without using dynbuf.
 
 Use of C functions that rely on a terminating zero must only be used on data
-that really do have a zero terminating zero.
+that really do have a null-terminating zero.
 
 ## Dangerous "data styles"
 
 Make extra precautions and verify that memory buffers that need a terminating
-zero always have exactly that. Buffers *without* a zero terminator must not be
+zero always have exactly that. Buffers *without* a null-terminator must not be
 used as input to string functions.
 
 # Commit messages
index 85a1e7d4515d70dc410d9e1242522adf2975beb9..e0676883c6335853209da7f7d3591ad29324da35 100644 (file)
@@ -37,7 +37,7 @@ CURLHcode curl_easy_header(CURL *easy,
 .SH DESCRIPTION
 \fIcurl_easy_header(3)\fP returns a pointer to a "curl_header" struct in
 \fBhout\fP with data for the HTTP response header \fIname\fP. The case
-insensitive nul-terminated header name should be specified without colon.
+insensitive null-terminated header name should be specified without colon.
 
 \fIindex\fP 0 means asking for the first instance of the header. If the
 returned header struct has \fBamount\fP set larger than 1, it means there are
@@ -94,7 +94,7 @@ but it might have a different case.
 
 The data \fBvalue\fP field points to, comes exactly as delivered over the
 network but with leading and trailing whitespace and newlines stripped
-off. The `value` data is nul-terminated. For legacy HTTP/1 "folded headers",
+off. The `value` data is null-terminated. For legacy HTTP/1 "folded headers",
 this API provides the full single value in an unfolded manner with a single
 whitespace between the lines.
 
index fa73ccceab6bad6600110f69317998b5f9376c60..934edd838fa145a2398e64913c0ea9d51d189bfc 100644 (file)
@@ -33,7 +33,7 @@ typedef enum {
   CURLOT_VALUES,  /*      (a defined set or bitmask) */
   CURLOT_OFF_T,   /* curl_off_t (a range of values) */
   CURLOT_OBJECT,  /* pointer (void *) */
-  CURLOT_STRING,  /*         (char * to zero terminated buffer) */
+  CURLOT_STRING,  /*         (char * to null-terminated buffer) */
   CURLOT_SLIST,   /*         (struct curl_slist *) */
   CURLOT_CBPTR,   /*         (void * passed as-is to a callback) */
   CURLOT_BLOB,    /* blob (struct curl_blob *) */
index 24988d54f292045e4c64b8c41e42984bc1daf415..459b40d7c5317fa88f8aca270aecefc5b3a12172 100644 (file)
@@ -56,7 +56,7 @@ the POST data from the read callback. If you want to send a zero-byte POST set
 \fICURLOPT_POSTFIELDS(3)\fP to an empty string, or set \fICURLOPT_POST(3)\fP to
 1 and \fICURLOPT_POSTFIELDSIZE(3)\fP to 0.
 
-libcurl will use assume this option points to a nul-terminated string unless
+libcurl will use assume this option points to a null-terminated string unless
 you also set \fICURLOPT_POSTFIELDSIZE(3)\fP to specify the length of the
 provided data, which then is strictly required if you want to send off nul
 bytes included in the data.
index 4f983b8df66fdcc6bb8cf5627184ea7ecb1468ad..ba345c7d3dc4358130e1b9535e142e0ceb4301f7 100644 (file)
@@ -59,12 +59,12 @@ The callback function must return \fICURL_PREREQFUNC_OK\fP on success, or
 
 This function is passed the following arguments:
 .IP conn_primary_ip
-A nul-terminated pointer to a C string containing the primary IP of the remote
-server established with this connection. For FTP, this is the IP for the
-control connection. IPv6 addresses are represented without surrounding
+A null-terminated pointer to a C string containing the primary IP of the
+remote server established with this connection. For FTP, this is the IP for
+the control connection. IPv6 addresses are represented without surrounding
 brackets.
 .IP conn_local_ip
-A nul-terminated pointer to a C string containing the originating IP for this
+A null-terminated pointer to a C string containing the originating IP for this
 connection. IPv6 addresses are represented without surrounding brackets.
 .IP conn_primary_port
 The primary port number on the remote server established with this connection.
index c8ac827c077ca6ebe30ca8345afd8b530d4c6e58..a792687cf456004e5a34d6a41c21cb54be23c740 100644 (file)
@@ -33,7 +33,7 @@ typedef enum {
   CURLOT_VALUES,  /*      (a defined set or bitmask) */
   CURLOT_OFF_T,   /* curl_off_t (a range of values) */
   CURLOT_OBJECT,  /* pointer (void *) */
-  CURLOT_STRING,  /*         (char * to zero terminated buffer) */
+  CURLOT_STRING,  /*         (char * to null-terminated buffer) */
   CURLOT_SLIST,   /*         (struct curl_slist *) */
   CURLOT_CBPTR,   /*         (void * passed as-is to a callback) */
   CURLOT_BLOB,    /* blob (struct curl_blob *) */
index 53ebc3db30a44a7ab3754acde1fd2226278cc162..a9142541c912cc53fd1be5ec40e647da27bc00e8 100644 (file)
@@ -138,7 +138,7 @@ CURLcode Curl_base64_decode(const char *src,
   /* Calculate the size of the decoded string */
   rawlen = (numQuantums * 3) - padding;
 
-  /* Allocate our buffer including room for a zero terminator */
+  /* Allocate our buffer including room for a null-terminator */
   newstr = malloc(rawlen + 1);
   if(!newstr)
     return CURLE_OUT_OF_MEMORY;
index d5d11113f41779554d2dcefc8b92ce596f7b1298..72e778b34e333796a67dfdf57224912096e36d13 100644 (file)
@@ -279,7 +279,7 @@ Curl_he2ai(const struct hostent *he, int port)
 
   for(i = 0; (curr = he->h_addr_list[i]) != NULL; i++) {
     size_t ss_size;
-    size_t namelen = strlen(he->h_name) + 1; /* include zero termination */
+    size_t namelen = strlen(he->h_name) + 1; /* include null-terminatior */
 #ifdef ENABLE_IPV6
     if(he->h_addrtype == AF_INET6)
       ss_size = sizeof(struct sockaddr_in6);
index a86e157fc047ee64852dc561d9af543ddf190f79..087258d93079d8dc7ae259c389dfdd3f2cb57ec9 100644 (file)
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -792,7 +792,7 @@ doh2ai(const struct dohentry *de, const char *hostname, int port)
 #endif
   CURLcode result = CURLE_OK;
   int i;
-  size_t hostlen = strlen(hostname) + 1; /* include zero terminator */
+  size_t hostlen = strlen(hostname) + 1; /* include null-terminator */
 
   if(!de)
     /* no input == no output! */
index 26c8cd54273f79aa105f1130e3a45e6368646338..04a728c7794faff1fc6b3a1033f59d88200b457d 100644 (file)
@@ -46,7 +46,7 @@
 
 struct dynbuf {
   char *bufr;    /* point to a null-terminated allocated buffer */
-  size_t leng;   /* number of bytes *EXCLUDING* the zero terminator */
+  size_t leng;   /* number of bytes *EXCLUDING* the null-terminator */
   size_t allc;   /* size of the current allocation */
   size_t toobig; /* size limit for the buffer */
 #ifdef DEBUGBUILD
index 69a92059808bfdc8f0c3b1efc80864d7a409d455..978c918f4f74b144f3bd7a93d0ce9aae40aa2e1c 100644 (file)
@@ -259,7 +259,7 @@ static CURLcode unfold_value(struct Curl_easy *data, const char *value,
 
   /* put the data at the end of the previous data, not the newline */
   memcpy(&newhs->value[olen], value, vlen);
-  newhs->value[olen + vlen] = 0; /* zero terminate at newline */
+  newhs->value[olen + vlen] = 0; /* null-terminate at newline */
 
   /* insert this node into the list of headers */
   Curl_llist_insert_next(&data->state.httphdrs, data->state.httphdrs.tail,
index 30347de250f3e6710b599f5e30897a2b20c55565..6bf55f661e5275ff1e330eddf45e22d5cd1a139a 100644 (file)
@@ -956,7 +956,7 @@ static int dprintf_formatf(
         else
           *fptr++ = 'f';
 
-        *fptr = 0; /* and a final zero termination */
+        *fptr = 0; /* and a final null-termination */
 
 #ifdef __clang__
 #pragma clang diagnostic push
index c6fd47e7f69ec136f47d2ef366a845123e51e714..2e7e7e8238b23582894eb13aea49d70dabc3c88e 100644 (file)
@@ -212,7 +212,7 @@ CURLcode Curl_rand(struct Curl_easy *data, unsigned char *rnd, size_t num)
 
 /*
  * Curl_rand_hex() fills the 'rnd' buffer with a given 'num' size with random
- * hexadecimal digits PLUS a zero terminating byte. It must be an odd number
+ * hexadecimal digits PLUS a null-terminating byte. It must be an odd number
  * size.
  */
 
@@ -235,7 +235,7 @@ CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd,
     /* make sure it fits in the local buffer and that it is an odd number! */
     return CURLE_BAD_FUNCTION_ARGUMENT;
 
-  num--; /* save one for zero termination */
+  num--; /* save one for null-termination */
 
   result = Curl_rand(data, buffer, num/2);
   if(result)
index 99f25b94e1e69d296d0a727b59b8ae2e149450ea..30fc29615a334f6d82591370ef3180a40a66a83d 100644 (file)
@@ -42,7 +42,7 @@ CURLcode Curl_rand(struct Curl_easy *data, unsigned char *rnd, size_t num);
 
 /*
  * Curl_rand_hex() fills the 'rnd' buffer with a given 'num' size with random
- * hexadecimal digits PLUS a zero terminating byte. It must be an odd number
+ * hexadecimal digits PLUS a null-terminating byte. It must be an odd number
  * size.
  */
 CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd,
index 9b4acd5a7a2ad82eb499fbc826e696effb86c27d..f945e8b6c9b17fdc0015f36ae99f4f71b14316b4 100644 (file)
@@ -382,7 +382,7 @@ CURLcode Curl_auth_create_digest_md5_message(struct Curl_easy *data,
   if(!(qop_values & DIGEST_QOP_VALUE_AUTH))
     return CURLE_BAD_CONTENT_ENCODING;
 
-  /* Generate 32 random hex chars, 32 bytes + 1 zero termination */
+  /* Generate 32 random hex chars, 32 bytes + 1 null-termination */
   result = Curl_rand_hex(data, (unsigned char *)cnonce, sizeof(cnonce));
   if(result)
     return result;
index edaacbb9edfea39e0dbd19f61eb23c99cd6f1880..948a504701eb66b47c262553053c83859d133de3 100644 (file)
@@ -658,7 +658,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
                    /* LanManager response */
                    /* NT response */
 
-                   0,                /* zero termination */
+                   0,                /* null-termination */
                    0, 0, 0,          /* type-3 long, the 24 upper bits */
 
                    SHORTPAIR(0x18),  /* LanManager response length, twice */
index 97b45040fcfd3528624487a2bbd7e7468e9d2dd1..a346bb0f71b98022864aee5423723b868f52d578 100644 (file)
@@ -47,7 +47,7 @@ int test(char *URL)
     return 1;
   }
 
-  /* make it a zero terminated C string with just As */
+  /* make it a null-terminated C string with just As */
   memset(buffer, 'A', MAX_INPUT_LENGTH + 1);
   buffer[MAX_INPUT_LENGTH + 1] = 0;
 
index 815d3038848a784c8e8fa9e2ad4dae3a1d845eb6..a4f70d1d52d6c708cde5839426f4e486e9511315 100644 (file)
@@ -75,7 +75,7 @@ static struct Curl_addrinfo *fake_ai(void)
 {
   static struct Curl_addrinfo *ai;
   static const char dummy[]="dummy";
-  size_t namelen = sizeof(dummy); /* including the zero terminator */
+  size_t namelen = sizeof(dummy); /* including the null-terminator */
 
   ai = calloc(1, sizeof(struct Curl_addrinfo) + sizeof(struct sockaddr_in) +
               namelen);