git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 12/19] remote-curl: avoid assigning string constant to non-const variable

From
Patrick Steinhardt <ps@pks.im>
Date
May 29, 2024, 12:44 UTC
Message-ID
<00b4a7dbbcdfd8a0f7b4beb4ecaf272257838460.1716983704.git.ps@pks.im>
In-Reply-To
<cover.1716983704.git.ps@pks.im>

When processing remote options, we split the option line into two by searching for a space. If there is one, we replace the space with '\0', otherwise we implicitly assume that the value is "true" and thus assign a string constant.

As the return value of strchr(3P) weirdly enough is a `char *` even though it gets a `const char *` as input, the assigned-to variable also is a non-constant. This is fine though because the argument is in fact an allocated string, and thus we are allowed to modify it. But this will break once we enable `-Wwrite-strings`.

Refactor the code stop splitting the fields with '\0' altogether. Instead, we can pass the length of the option name to `set_option()` and then use strncmp(3P) instead of strcmp(3P).

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 remote-curl.c | 58 +++++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 27 deletions(-)
diff --git a/remote-curl.c b/remote-curl.c
index cae98384da..ac185d4f88 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -58,9 +58,9 @@ struct options {
 static struct options options;
 static struct string_list cas_options = STRING_LIST_INIT_DUP;
 
-static int set_option(const char *name, const char *value)
+static int set_option(const char *name, size_t namelen, const char *value)
 {
-	if (!strcmp(name, "verbosity")) {
+	if (!strncmp(name, "verbosity", namelen)) {
 		char *end;
 		int v = strtol(value, &end, 10);
 		if (value == end || *end)
@@ -68,7 +68,7 @@ static int set_option(const char *name, const char *value)
 		options.verbosity = v;
 		return 0;
 	}
-	else if (!strcmp(name, "progress")) {
+	else if (!strncmp(name, "progress", namelen)) {
 		if (!strcmp(value, "true"))
 			options.progress = 1;
 		else if (!strcmp(value, "false"))
@@ -77,7 +77,7 @@ static int set_option(const char *name, const char *value)
 			return -1;
 		return 0;
 	}
-	else if (!strcmp(name, "depth")) {
+	else if (!strncmp(name, "depth", namelen)) {
 		char *end;
 		unsigned long v = strtoul(value, &end, 10);
 		if (value == end || *end)
@@ -85,15 +85,15 @@ static int set_option(const char *name, const char *value)
 		options.depth = v;
 		return 0;
 	}
-	else if (!strcmp(name, "deepen-since")) {
+	else if (!strncmp(name, "deepen-since", namelen)) {
 		options.deepen_since = xstrdup(value);
 		return 0;
 	}
-	else if (!strcmp(name, "deepen-not")) {
+	else if (!strncmp(name, "deepen-not", namelen)) {
 		string_list_append(&options.deepen_not, value);
 		return 0;
 	}
-	else if (!strcmp(name, "deepen-relative")) {
+	else if (!strncmp(name, "deepen-relative", namelen)) {
 		if (!strcmp(value, "true"))
 			options.deepen_relative = 1;
 		else if (!strcmp(value, "false"))
@@ -102,7 +102,7 @@ static int set_option(const char *name, const char *value)
 			return -1;
 		return 0;
 	}
-	else if (!strcmp(name, "followtags")) {
+	else if (!strncmp(name, "followtags", namelen)) {
 		if (!strcmp(value, "true"))
 			options.followtags = 1;
 		else if (!strcmp(value, "false"))
@@ -111,7 +111,7 @@ static int set_option(const char *name, const char *value)
 			return -1;
 		return 0;
 	}
-	else if (!strcmp(name, "dry-run")) {
+	else if (!strncmp(name, "dry-run", namelen)) {
 		if (!strcmp(value, "true"))
 			options.dry_run = 1;
 		else if (!strcmp(value, "false"))
@@ -120,7 +120,7 @@ static int set_option(const char *name, const char *value)
 			return -1;
 		return 0;
 	}
-	else if (!strcmp(name, "check-connectivity")) {
+	else if (!strncmp(name, "check-connectivity", namelen)) {
 		if (!strcmp(value, "true"))
 			options.check_self_contained_and_connected = 1;
 		else if (!strcmp(value, "false"))
@@ -129,7 +129,7 @@ static int set_option(const char *name, const char *value)
 			return -1;
 		return 0;
 	}
-	else if (!strcmp(name, "cas")) {
+	else if (!strncmp(name, "cas", namelen)) {
 		struct strbuf val = STRBUF_INIT;
 		strbuf_addstr(&val, "--force-with-lease=");
 		if (*value != '"')
@@ -139,7 +139,7 @@ static int set_option(const char *name, const char *value)
 		string_list_append(&cas_options, val.buf);
 		strbuf_release(&val);
 		return 0;
-	} else if (!strcmp(name, TRANS_OPT_FORCE_IF_INCLUDES)) {
+	} else if (!strncmp(name, TRANS_OPT_FORCE_IF_INCLUDES, namelen)) {
 		if (!strcmp(value, "true"))
 			options.force_if_includes = 1;
 		else if (!strcmp(value, "false"))
@@ -147,7 +147,7 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "cloning")) {
+	} else if (!strncmp(name, "cloning", namelen)) {
 		if (!strcmp(value, "true"))
 			options.cloning = 1;
 		else if (!strcmp(value, "false"))
@@ -155,7 +155,7 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "update-shallow")) {
+	} else if (!strncmp(name, "update-shallow", namelen)) {
 		if (!strcmp(value, "true"))
 			options.update_shallow = 1;
 		else if (!strcmp(value, "false"))
@@ -163,7 +163,7 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "pushcert")) {
+	} else if (!strncmp(name, "pushcert", namelen)) {
 		if (!strcmp(value, "true"))
 			options.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;
 		else if (!strcmp(value, "false"))
@@ -173,7 +173,7 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "atomic")) {
+	} else if (!strncmp(name, "atomic", namelen)) {
 		if (!strcmp(value, "true"))
 			options.atomic = 1;
 		else if (!strcmp(value, "false"))
@@ -181,7 +181,7 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "push-option")) {
+	} else if (!strncmp(name, "push-option", namelen)) {
 		if (*value != '"')
 			string_list_append(&options.push_options, value);
 		else {
@@ -192,7 +192,7 @@ static int set_option(const char *name, const char *value)
 						 strbuf_detach(&unquoted, NULL));
 		}
 		return 0;
-	} else if (!strcmp(name, "family")) {
+	} else if (!strncmp(name, "family", namelen)) {
 		if (!strcmp(value, "ipv4"))
 			git_curl_ipresolve = CURL_IPRESOLVE_V4;
 		else if (!strcmp(value, "ipv6"))
@@ -202,16 +202,16 @@ static int set_option(const char *name, const char *value)
 		else
 			return -1;
 		return 0;
-	} else if (!strcmp(name, "from-promisor")) {
+	} else if (!strncmp(name, "from-promisor", namelen)) {
 		options.from_promisor = 1;
 		return 0;
-	} else if (!strcmp(name, "refetch")) {
+	} else if (!strncmp(name, "refetch", namelen)) {
 		options.refetch = 1;
 		return 0;
-	} else if (!strcmp(name, "filter")) {
+	} else if (!strncmp(name, "filter", namelen)) {
 		options.filter = xstrdup(value);
 		return 0;
-	} else if (!strcmp(name, "object-format")) {
+	} else if (!strncmp(name, "object-format", namelen)) {
 		options.object_format = 1;
 		if (strcmp(value, "true"))
 			die(_("unknown value for object-format: %s"), value);
@@ -1588,15 +1588,19 @@ int cmd_main(int argc, const char **argv)
 			parse_push(&buf);
 
 		} else if (skip_prefix(buf.buf, "option ", &arg)) {
-			char *value = strchr(arg, ' ');
+			const char *value = strchr(arg, ' ');
+			size_t arglen;
 			int result;
 
-			if (value)
-				*value++ = '\0';
-			else
+			if (value) {
+				arglen = value - arg;
+				value++;
+			} else {
+				arglen = strlen(arg);
 				value = "true";
+			}
 
-			result = set_option(arg, value);
+			result = set_option(arg, arglen, value);
 			if (!result)
 				printf("ok\n");
 			else if (result < 0)
-- 
2.45.1.313.g3a57aa566a.dirty
Previous: Patrick SteinhardtNext: Junio C Hamano
Message 36 of 205 in “Compile with `-Wwrite-strings`”
  1. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 29, 2024
  2. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  3. Junio C HamanoMay 29, 2024
  4. Patrick SteinhardtMay 30, 2024
  5. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 29, 2024
  6. Junio C HamanoMay 29, 2024
  7. Patrick SteinhardtMay 30, 2024
  8. Junio C HamanoMay 30, 2024
  9. Patrick SteinhardtMay 31, 2024
  10. Patrick SteinhardtMay 31, 2024
  11. Junio C HamanoMay 31, 2024
  12. Junio C HamanoMay 31, 2024
  13. Jeff KingJun 5, 2024
  14. Junio C HamanoJun 5, 2024
  15. Jeff KingJun 8, 2024
  16. Patrick SteinhardtJun 6, 2024
  17. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 29, 2024
  18. Junio C HamanoMay 29, 2024
  19. Patrick SteinhardtMay 30, 2024
  20. Junio C HamanoMay 30, 2024
  21. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 29, 2024
  22. 05/19 reftable: improve const correctness when assigning string constantsPatrick Steinhardt, May 29, 2024
  23. Junio C HamanoMay 29, 2024
  24. Patrick SteinhardtMay 30, 2024
  25. Junio C HamanoMay 30, 2024
  26. 06/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 29, 2024
  27. Junio C HamanoMay 29, 2024
  28. 07/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 29, 2024
  29. Junio C HamanoMay 29, 2024
  30. 08/19 line-log: always allocate the output prefixPatrick Steinhardt, May 29, 2024
  31. Junio C HamanoMay 29, 2024
  32. 09/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 29, 2024
  33. Junio C HamanoMay 29, 2024
  34. 10/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 29, 2024
  35. 11/19 send-pack: always allocate receive statusPatrick Steinhardt, May 29, 2024
  36. 12/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 29, 2024
  37. Junio C HamanoMay 29, 2024
  38. Patrick SteinhardtMay 30, 2024
  39. 13/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 29, 2024
  40. Junio C HamanoMay 29, 2024
  41. 14/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 29, 2024
  42. 15/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 29, 2024
  43. 16/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 29, 2024
  44. Junio C HamanoMay 29, 2024
  45. Patrick SteinhardtMay 30, 2024
  46. Junio C HamanoMay 30, 2024
  47. 17/19 builtin/rebase: adapt code to not assign string constants to non-constPatrick Steinhardt, May 29, 2024
  48. Junio C HamanoMay 29, 2024
  49. Patrick SteinhardtMay 30, 2024
  50. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 29, 2024
  51. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 29, 2024
  52. Patrick SteinhardtMay 29, 2024
  53. 00/19 Compile with `-Wwrite-strings`Patrick Steinhardt, May 30, 2024
  54. 01/19 global: improve const correctness when assigning string constantsPatrick Steinhardt, May 30, 2024
  55. 02/19 global: assign non-const strings as requiredPatrick Steinhardt, May 30, 2024
  56. 03/19 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, May 30, 2024
  57. 04/19 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, May 30, 2024
  58. 05/19 refspec: remove global tag refspec structurePatrick Steinhardt, May 30, 2024
  59. 06/19 http: do not assign string constant to non-const fieldPatrick Steinhardt, May 30, 2024
  60. 07/19 line-log: always allocate the output prefixPatrick Steinhardt, May 30, 2024
  61. 08/19 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, May 30, 2024
  62. 09/19 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, May 30, 2024
  63. 10/19 send-pack: always allocate receive statusPatrick Steinhardt, May 30, 2024
  64. 11/19 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, May 30, 2024
  65. 12/19 revision: always store allocated strings in output encodingPatrick Steinhardt, May 30, 2024
  66. 13/19 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, May 30, 2024
  67. 14/19 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, May 30, 2024
  68. 15/19 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, May 30, 2024
  69. 16/19 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, May 30, 2024
  70. 17/19 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, May 30, 2024
  71. 18/19 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, May 30, 2024
  72. 19/19 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, May 30, 2024
  73. Junio C HamanoMay 31, 2024
  74. Patrick SteinhardtMay 31, 2024
  75. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 3, 2024
  76. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 3, 2024
  77. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 3, 2024
  78. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 3, 2024
  79. Junio C HamanoJun 3, 2024
  80. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 3, 2024
  81. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 3, 2024
  82. Junio C HamanoJun 3, 2024
  83. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 3, 2024
  84. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 3, 2024
  85. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 3, 2024
  86. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 3, 2024
  87. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 3, 2024
  88. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 3, 2024
  89. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 3, 2024
  90. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 3, 2024
  91. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 3, 2024
  92. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 3, 2024
  93. Eric SunshineJun 3, 2024
  94. Junio C HamanoJun 3, 2024
  95. Patrick SteinhardtJun 4, 2024
  96. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 3, 2024
  97. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 3, 2024
  98. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 3, 2024
  99. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 3, 2024
  100. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 3, 2024
  101. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 3, 2024
  102. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 3, 2024
  103. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 3, 2024
  104. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 3, 2024
  105. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 3, 2024
  106. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 3, 2024
  107. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 3, 2024
  108. Junio C HamanoJun 3, 2024
  109. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 4, 2024
  110. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 4, 2024
  111. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 4, 2024
  112. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 4, 2024
  113. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 4, 2024
  114. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 4, 2024
  115. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 4, 2024
  116. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 4, 2024
  117. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 4, 2024
  118. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 4, 2024
  119. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 4, 2024
  120. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 4, 2024
  121. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 4, 2024
  122. Junio C HamanoJun 6, 2024
  123. Junio C HamanoJun 6, 2024
  124. Patrick SteinhardtJun 6, 2024
  125. Junio C HamanoJun 6, 2024
  126. Patrick SteinhardtJun 7, 2024
  127. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 4, 2024
  128. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 4, 2024
  129. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 4, 2024
  130. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 4, 2024
  131. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 4, 2024
  132. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 4, 2024
  133. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 4, 2024
  134. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 4, 2024
  135. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 4, 2024
  136. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 4, 2024
  137. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 4, 2024
  138. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 4, 2024
  139. Phillip WoodJun 4, 2024
  140. Patrick SteinhardtJun 5, 2024
  141. Phillip WoodJun 5, 2024
  142. Patrick SteinhardtJun 6, 2024
  143. Junio C HamanoJun 5, 2024
  144. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 4, 2024
  145. Phillip WoodJun 4, 2024
  146. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 4, 2024
  147. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 4, 2024
  148. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 6, 2024
  149. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 6, 2024
  150. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 6, 2024
  151. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 6, 2024
  152. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 6, 2024
  153. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 6, 2024
  154. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 6, 2024
  155. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 6, 2024
  156. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 6, 2024
  157. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 6, 2024
  158. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 6, 2024
  159. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 6, 2024
  160. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 6, 2024
  161. Junio C HamanoJun 6, 2024
  162. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 6, 2024
  163. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 6, 2024
  164. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 6, 2024
  165. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 6, 2024
  166. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 6, 2024
  167. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 6, 2024
  168. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 6, 2024
  169. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 6, 2024
  170. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 6, 2024
  171. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 6, 2024
  172. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 6, 2024
  173. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 6, 2024
  174. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 6, 2024
  175. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 6, 2024
  176. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 6, 2024
  177. 00/27 Compile with `-Wwrite-strings`Patrick Steinhardt, Jun 7, 2024
  178. 01/27 global: improve const correctness when assigning string constantsPatrick Steinhardt, Jun 7, 2024
  179. 02/27 global: convert intentionally-leaking config strings to constsPatrick Steinhardt, Jun 7, 2024
  180. 03/27 refs/reftable: stop micro-optimizing refname allocations on copyPatrick Steinhardt, Jun 7, 2024
  181. 04/27 reftable: cast away constness when assigning constants to recordsPatrick Steinhardt, Jun 7, 2024
  182. 05/27 refspec: remove global tag refspec structurePatrick Steinhardt, Jun 7, 2024
  183. 06/27 builtin/remote: cast away constness in `get_head_names()`Patrick Steinhardt, Jun 7, 2024
  184. 07/27 diff: cast string constant in `fill_textconv()`Patrick Steinhardt, Jun 7, 2024
  185. 08/27 line-log: stop assigning string constant to file parent bufferPatrick Steinhardt, Jun 7, 2024
  186. 09/27 line-log: always allocate the output prefixPatrick Steinhardt, Jun 7, 2024
  187. 10/27 entry: refactor how we remove items for delayed checkoutsPatrick Steinhardt, Jun 7, 2024
  188. 11/27 ident: add casts for fallback name and GECOSPatrick Steinhardt, Jun 7, 2024
  189. 12/27 object-file: mark cached object buffers as constPatrick Steinhardt, Jun 7, 2024
  190. 13/27 object-file: make `buf` parameter of `index_mem()` a constantPatrick Steinhardt, Jun 7, 2024
  191. 14/27 pretty: add casts for decoration option pointersPatrick Steinhardt, Jun 7, 2024
  192. 15/27 compat/win32: fix const-correctness with string constantsPatrick Steinhardt, Jun 7, 2024
  193. 16/27 http: do not assign string constant to non-const fieldPatrick Steinhardt, Jun 7, 2024
  194. 17/27 parse-options: cast long name for OPTION_ALIASPatrick Steinhardt, Jun 7, 2024
  195. 18/27 send-pack: always allocate receive statusPatrick Steinhardt, Jun 7, 2024
  196. 19/27 remote-curl: avoid assigning string constant to non-const variablePatrick Steinhardt, Jun 7, 2024
  197. 20/27 revision: always store allocated strings in output encodingPatrick Steinhardt, Jun 7, 2024
  198. 21/27 mailmap: always store allocated strings in mailmap blobPatrick Steinhardt, Jun 7, 2024
  199. 22/27 imap-send: drop global `imap_server_conf` variablePatrick Steinhardt, Jun 7, 2024
  200. 23/27 imap-send: fix leaking memory in `imap_server_conf`Patrick Steinhardt, Jun 7, 2024
  201. 24/27 builtin/rebase: do not assign default backend to non-constant fieldPatrick Steinhardt, Jun 7, 2024
  202. 25/27 builtin/rebase: always store allocated string in `options.strategy`Patrick Steinhardt, Jun 7, 2024
  203. 26/27 builtin/merge: always store allocated strings in `pull_twohead`Patrick Steinhardt, Jun 7, 2024
  204. 27/27 config.mak.dev: enable `-Wwrite-strings` warningPatrick Steinhardt, Jun 7, 2024
  205. Junio C HamanoJun 7, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.