X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=quote.c;h=dcc23266109ce30e3fd098f3c76799b67b75a332;hb=91df4330d35f1f1670dd04af0a14f1ca84a72b2b;hp=76eb14426581f03d0b15ee4eb720456a0729d1bc;hpb=9ef2b3cbf62d15aa0312bde349347873d7c0f399;p=git.git diff --git a/quote.c b/quote.c index 76eb1442..dcc23266 100644 --- a/quote.c +++ b/quote.c @@ -126,8 +126,10 @@ static int quote_c_style_counted(const char *name, int namelen, if (!no_dq) EMIT('"'); - for (sp = name; (ch = *sp++) && (sp - name) <= namelen; ) { - + for (sp = name; sp < name + namelen; sp++) { + ch = *sp; + if (!ch) + break; if ((ch < ' ') || (ch == '"') || (ch == '\\') || (ch == 0177)) { needquote = 1; @@ -142,8 +144,6 @@ static int quote_c_style_counted(const char *name, int namelen, case '\\': /* fallthru */ case '"': EMITQ(); break; - case ' ': - break; default: /* octal */ EMITQ(); @@ -206,7 +206,14 @@ char *unquote_c_style(const char *quoted, const char **endp) case '\\': case '"': break; /* verbatim */ - case '0'...'7': + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': /* octal */ ac = ((ch - '0') << 6); if ((ch = *sp++) < '0' || '7' < ch)