From: Michihiro NAKAJIMA Date: Thu, 11 Oct 2012 10:51:08 +0000 (+0900) Subject: Fix few bugs in archive_cmdline. X-Git-Tag: v3.1.0~40^2~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25169e1b2c467bcee6adb80d7070a968c3ab4c3f;p=thirdparty%2Flibarchive.git Fix few bugs in archive_cmdline. --- diff --git a/libarchive/archive_cmdline.c b/libarchive/archive_cmdline.c index 5129ab3d6..7d3bac53b 100644 --- a/libarchive/archive_cmdline.c +++ b/libarchive/archive_cmdline.c @@ -46,14 +46,19 @@ extract_quotation(struct archive_string *as, const char *p) { const char *s; - for (s = p + 1; *s; s++) { + for (s = p + 1; *s;) { if (*s == '\\') { - if (s[1] != '\0') - archive_strappend_char(as, s[0]); + if (s[1] != '\0') { + archive_strappend_char(as, s[1]); + s += 2; + } else + s++; } else if (*s == '"') break; - else + else { archive_strappend_char(as, s[0]); + s++; + } } if (*s != '"') return (ARCHIVE_FAILED);/* Invalid sequence. */ @@ -197,7 +202,7 @@ struct archive_cmdline * __archive_cmdline_allocate(void) { return (struct archive_cmdline *) - calloc(1, sizeof(struct archive_cmdline *)); + calloc(1, sizeof(struct archive_cmdline)); } /*