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

[PATCH] fix uninitialized variable in string_expand_length

From
Jeff King <peff@peff.net>
Date
Feb 7, 2009, 10:37 UTC
Message-ID
<20090207103723.GA18823@coredump.intra.peff.net>

This led to totally unpredictable results from the function. The style matches the loop in string_expand.

Signed-off-by: Jeff King <peff@peff.net>
---
 tig.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tig.c b/tig.c
index 79afdb1..97794b0 100644
--- a/tig.c
+++ b/tig.c
@@ -193,7 +193,7 @@ string_expand_length(const char *line, int tabsize)
 {
 	size_t size, pos;
 
-	for (pos = 0; line[pos]; pos++) {
+	for (size = pos = 0; line[pos]; pos++) {
 		if (line[pos] == '\t' && tabsize > 0)
 			size += tabsize - (size % tabsize);
 		else
-- 
1.6.1.2.552.g1682c.dirty
Next: Jonas Fonseca
Message 1 of 2 in “fix uninitialized variable in string_expand_length”
  1. fix uninitialized variable in string_expand_lengthJeff King, Feb 7, 2009
  2. Jonas FonsecaFeb 8, 2009

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.