Skip to content

Commit 4429186

Browse files
committed
path validation: char is not signed by default.
ARM treats its `char` type as `unsigned type` by default; as a result, testing a `char` value as being `< 0` is always false. This is a warning on ARM, which is promoted to an error given our use of `-Werror`. Per ISO 9899:199, section "6.2.5 Types": > The three types char, signed char, and unsigned char are collectively > called the character types. The implementation shall define char to > have the same range, representation, and behavior as either signed > char or unsigned char. > ... > Irrespective of the choice made, char is a separate type from the other > two and is not compatible with either.
1 parent bc34cb6 commit 4429186

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ GIT_INLINE(bool) verify_dotgit_ntfs_generic(const char *name, size_t len, const
16621662
saw_tilde = 1;
16631663
} else if (i >= 6) {
16641664
return true;
1665-
} else if (name[i] < 0) {
1665+
} else if ((unsigned char)name[i] > 127) {
16661666
return true;
16671667
} else if (git__tolower(name[i]) != shortname_pfix[i]) {
16681668
return true;

0 commit comments

Comments
 (0)