X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fxheader.c;h=d5a75b3e32d8678348fca82b7dcdbe37db3751bc;hb=4ed709c3c2376017c04ab827eaf93bd8ccf7c3a5;hp=1441eec8728b5e14f4d1f5bdcf74737fcea20586;hpb=c95535bae88651c71eeab8806004994c582256d8;p=chaz%2Ftar diff --git a/src/xheader.c b/src/xheader.c index 1441eec..d5a75b3 100644 --- a/src/xheader.c +++ b/src/xheader.c @@ -20,6 +20,7 @@ #include #include +#include #include "common.h" @@ -290,7 +291,9 @@ atime_coder (struct tar_stat_info const *st, char const *keyword, static void atime_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_atime = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_atime = u; } static void @@ -303,7 +306,9 @@ gid_coder (struct tar_stat_info const *st, char const *keyword, static void gid_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_gid = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_gid = u; } static void @@ -342,7 +347,9 @@ ctime_coder (struct tar_stat_info const *st, char const *keyword, static void ctime_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_ctime = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_ctime = u; } static void @@ -355,7 +362,9 @@ mtime_coder (struct tar_stat_info const *st, char const *keyword, static void mtime_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_mtime = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_mtime = u; } static void @@ -383,7 +392,9 @@ size_coder (struct tar_stat_info const *st, char const *keyword, static void size_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_size = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_size = u; } static void @@ -396,7 +407,9 @@ uid_coder (struct tar_stat_info const *st, char const *keyword, static void uid_decoder (struct tar_stat_info *st, char const *arg) { - st->stat.st_uid = strtoul (arg, NULL, 0); + uintmax_t u; + if (xstrtoumax (arg, 0, 10, &u, "") == LONGINT_OK) + st->stat.st_uid = u; } static void