aboutsummaryrefslogtreecommitdiff
path: root/lib/common/src/fstree_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common/src/fstree_cli.c')
-rw-r--r--lib/common/src/fstree_cli.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/common/src/fstree_cli.c b/lib/common/src/fstree_cli.c
index 179a1f5..a1a41c3 100644
--- a/lib/common/src/fstree_cli.c
+++ b/lib/common/src/fstree_cli.c
@@ -11,6 +11,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
enum {
DEF_UID = 0,
@@ -75,11 +76,16 @@ int parse_fstree_defaults(fstree_defaults_t *sb, char *subopts)
sb->mode = S_IFDIR | (sqfs_u16)lval;
break;
case DEF_MTIME:
+ errno = 0;
lval = strtol(value, NULL, 0);
if (lval < 0)
goto fail_uv;
- if (lval > (long)UINT32_MAX)
+ if (sizeof(long) > sizeof(sqfs_u32)) {
+ if (lval > (long)UINT32_MAX)
+ goto fail_ov;
+ } else if (errno != 0) {
goto fail_ov;
+ }
sb->mtime = lval;
break;
default: