Skip to contentSkip to conversation

main - dmsetup: check also for ouf of range value

PATCH Zdenek Kabelac 1 participant 1 message Aug 19, 2022

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=718e38d5faf3a3ca23690d2f4203df1df65eba77
Commit:        718e38d5faf3a3ca23690d2f4203df1df65eba77
Parent:        a3eb6ba425773224076c41aabc3c490a6a016ee6
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Thu Aug 18 13:56:03 2022 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Aug 19 14:56:57 2022 +0200

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(-)
libdm/dm-tools/dmsetup.c +2 -1
index 8502d9adc..42eeead68 100644
@@ -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 : "");