Revert "refs.c: off-by-one fix."
This reverts 06bf6ac4248e834a229027908d405f5e42ac96d7 commit.
Junio C Hamano committed
Dec 16, 2005 at 23:48 UTC
8872f27b8773dfe7d3dbb440c27d4a5a9dbc8470
1 file changed
+2
-5
refs.c
+2
-5
@@ -348,11 +348,8 @@ int check_ref_format(const char *ref)
348
if (level < 2)
349
return -1; /* at least of form "heads/blah" */
350
351
- /* Do not allow ref name to end in "HEAD"
352
- * Note that cp is poiting at one past NUL at the end.
353
- * i.e. cp[-1] = NUL.
354
- */
355
- if (5 <= cp - ref && !strcmp(cp - 5, "HEAD"))
351
+ /* do not allow ref name to end in "HEAD" */
352
+ if (cp - ref > 4 && !strcmp(cp - 4, "HEAD"))
353
return -1;
354
355
return 0;