aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-for-each-ref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index c904ac310..00afe8931 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -113,7 +113,7 @@ static int parse_atom(const char *atom, const char *ep)
* table.
*/
const char *formatp = strchr(sp, ':');
- if (!formatp)
+ if (!formatp || ep < formatp)
formatp = ep;
if (len == formatp - sp && !memcmp(valid_atom[i].name, sp, len))
break;