--- busybox-1.10.1/archival/libunarchive/get_header_tar.c +++ busybox-1.10.1/archival/libunarchive/get_header_tar.c @@ -24,18 +24,20 @@ }; #endif -/* NB: _DESTROYS_ str[len] character! */ static unsigned long long getOctal(char *str, int len) { unsigned long long v; + char last; /* Actually, tar header allows leading spaces also. * Oh well, we will be liberal and skip this... * The only downside probably is that we allow "-123" too :) if (*str < '0' || *str > '7') bb_error_msg_and_die("corrupted octal value in tar header"); */ + last = str[len]; str[len] = '\0'; v = strtoull(str, &str, 8); + str[len] = last; if (*str && (!ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY || *str != ' ')) bb_error_msg_and_die("corrupted octal value in tar header"); return v;