int len, baselen, ch;
baselen = strlen(base);
- len = baselen + 7; /* "/refs/" + NUL */
+ len = baselen + 2; /* '/' after base and terminating NUL */
for (cp = ref; (ch = *cp) != 0; cp++, len++)
if (needs_quote(ch))
len += 2; /* extra two hex plus replacement % */