Skip to content

Commit 9734b74

Browse files
peffgitster
authored andcommitted
normalize_path_copy(): document "dst" size expectations
We take a "dst" buffer to write into, but there's no matching "len" parameter. The hidden assumption is that normalizing always makes things smaller, so we're OK as long as "dst" is at least as big as "src". Let's document that explicitly. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d0654dc commit 9734b74

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

path.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ const char *remove_leading_path(const char *in, const char *prefix)
10771077

10781078
/*
10791079
* It is okay if dst == src, but they should not overlap otherwise.
1080+
* The "dst" buffer must be at least as long as "src"; normalizing may shrink
1081+
* the size of the path, but will never grow it.
10801082
*
10811083
* Performs the following normalizations on src, storing the result in dst:
10821084
* - Ensures that components are separated by '/' (Windows only)

0 commit comments

Comments
 (0)