From 4ed709c3c2376017c04ab827eaf93bd8ccf7c3a5 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 13 Nov 2003 08:47:25 +0000 Subject: [PATCH] (atime_decoder,gid_decoder,ctime_decoder) (mtime_decoder,size_decoder,uid_decoder): Use xstrtoumax. Fixes "pax-big-10g" bug --- src/xheader.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) 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 -- 2.44.0