mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
tar: avoid strtoul().
This is part of the general trend to prefer signed integer types, to allow better runtime checking with -fsanitize=undefined etc. * (struct tar_stat_info): ue intmax_t, not unsigned, for sparse major and minor. * (tar_sparse_major): likewise. * (tar_sparse_minor): likewise. Sync with GNU tar 4642cd04edbd57414e004920fa4976d9f3be6206. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
79b10fc8a7
commit
20b617a8ab
@ -268,8 +268,8 @@ struct tar_stat_info
|
|||||||
gboolean is_sparse; /**< is the file sparse */
|
gboolean is_sparse; /**< is the file sparse */
|
||||||
|
|
||||||
/* For sparse files */
|
/* For sparse files */
|
||||||
unsigned int sparse_major;
|
intmax_t sparse_major;
|
||||||
unsigned int sparse_minor;
|
intmax_t sparse_minor;
|
||||||
GArray *sparse_map; /**< array of struct sp_array */
|
GArray *sparse_map; /**< array of struct sp_array */
|
||||||
|
|
||||||
off_t real_size; /**< real size of sparse file */
|
off_t real_size; /**< real size of sparse file */
|
||||||
|
@ -772,7 +772,7 @@ sparse_major_decoder (struct tar_stat_info *st, const char *keyword, const char
|
|||||||
|
|
||||||
(void) size;
|
(void) size;
|
||||||
|
|
||||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
|
if (!decode_num (&u, arg, INTMAX_MAX, keyword))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
st->sparse_major = u;
|
st->sparse_major = u;
|
||||||
@ -788,7 +788,7 @@ sparse_minor_decoder (struct tar_stat_info *st, const char *keyword, const char
|
|||||||
|
|
||||||
(void) size;
|
(void) size;
|
||||||
|
|
||||||
if (!decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
|
if (!decode_num (&u, arg, INTMAX_MAX, keyword))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
st->sparse_minor = u;
|
st->sparse_minor = u;
|
||||||
|
Loading…
Reference in New Issue
Block a user