29 lines
857 B
Diff
29 lines
857 B
Diff
From 718e38d5faf3a3ca23690d2f4203df1df65eba77 Mon Sep 17 00:00:00 2001
|
|
From: Zdenek Kabelac <zkabelac@redhat.com>
|
|
Date: Thu, 18 Aug 2022 13:56:03 +0200
|
|
Subject: [PATCH 094/270] dmsetup: check also for ouf of range value
|
|
|
|
Check errno result from strtoull().
|
|
---
|
|
libdm/dm-tools/dmsetup.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
|
|
index 8502d9adc..42eeead68 100644
|
|
--- a/libdm/dm-tools/dmsetup.c
|
|
+++ b/libdm/dm-tools/dmsetup.c
|
|
@@ -5106,8 +5106,9 @@ static int _size_from_string(char *argptr, uint64_t *size, const char *name)
|
|
if (!argptr)
|
|
return_0;
|
|
|
|
+ errno = 0;
|
|
*size = strtoull(argptr, &endptr, 10);
|
|
- if (endptr == argptr) {
|
|
+ if (errno || endptr == argptr) {
|
|
*size = 0;
|
|
log_error("Invalid %s argument: \"%s\"",
|
|
name, (*argptr) ? argptr : "");
|
|
--
|
|
2.33.0
|
|
|