Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: [PATCH v2 00/45] parse_pathspec and :(glob) magic

From: Duy Nguyen <hidden>
Date: 2016-06-15 22:56:28
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

On Thu, Mar 21, 2013 at 12:33:26PM +0700, Duy Nguyen wrote:
quoted hunk ↗ jump to hunk
quoted
I am still getting this out of 7300, though.
I still can't reproduce it. But I think I found a bug that
miscalculates prefix length from absolute paths. Does this "fix" your
test?

-- 8< --
diff --git a/setup.c b/setup.c
index 3584f22..6ae147a 100644
--- a/setup.c
+++ b/setup.c
@@ -14,6 +14,7 @@ char *prefix_path_gently(const char *prefix, int *p_len, const char *path)
 		const char *temp = real_path(path);
 		sanitized = xmalloc(len + strlen(temp) + 1);
 		strcpy(sanitized, temp);
+		*p_len = 0;
 	} else {
 		sanitized = xmalloc(len + strlen(path) + 1);
 		if (len)

-- 8< --
Nope, that one could cause more crashes. Try this

-- 8< --
diff --git a/setup.c b/setup.c
index 3584f22..3d8eb97 100644
--- a/setup.c
+++ b/setup.c
@@ -14,6 +14,8 @@ char *prefix_path_gently(const char *prefix, int *p_len, const char *path)
 		const char *temp = real_path(path);
 		sanitized = xmalloc(len + strlen(temp) + 1);
 		strcpy(sanitized, temp);
+		if (p_len)
+			*p_len = 0;
 	} else {
 		sanitized = xmalloc(len + strlen(path) + 1);
 		if (len)
-- 8< --
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help