diff options
author | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-10-11 19:51:08 +0900 |
---|---|---|
committer | Michihiro NAKAJIMA <ggcueroad@gmail.com> | 2012-10-11 19:51:08 +0900 |
commit | 25169e1b2c467bcee6adb80d7070a968c3ab4c3f (patch) | |
tree | 40edc9197de99159dab0a2a412a776765bfb84f8 /libarchive/archive_cmdline.c | |
parent | b72acb3019ab88bac8f064e4e077b1093c9ff339 (diff) | |
download | libarchive-25169e1b2c467bcee6adb80d7070a968c3ab4c3f.tar.gz |
Fix few bugs in archive_cmdline.
Diffstat (limited to 'libarchive/archive_cmdline.c')
-rw-r--r-- | libarchive/archive_cmdline.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libarchive/archive_cmdline.c b/libarchive/archive_cmdline.c index 5129ab3d..7d3bac53 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)); } /* |