[PATCH 1/2] dir.c: avoid gcc warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Related to -Wstringop-overread.

In fact, this may be a false positive, but reading until the correct end
is desirable here anyways.

Signed-off-by: Michael J Gruber <git@xxxxxxxxx>
---
 dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dir.c b/dir.c
index 26c4d141ab..32fcaae4c0 100644
--- a/dir.c
+++ b/dir.c
@@ -3145,7 +3145,7 @@ char *git_url_basename(const char *repo, int is_bundle, int is_bare)
 	 * result in a dir '2222' being guessed due to backwards
 	 * compatibility.
 	 */
-	if (memchr(start, '/', end - start) == NULL
+	if (memchr(start, '/', end - start + 1) == NULL
 	    && memchr(start, ':', end - start) != NULL) {
 		ptr = end;
 		while (start < ptr && isdigit(ptr[-1]) && ptr[-1] != ':')
-- 
2.36.0.553.g068b50827d




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux