35 lines
926 B
Diff
35 lines
926 B
Diff
From 8f9ac30dcb144d4ce79f88e8a01fba0968da3a07 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Tue, 9 Oct 2018 18:03:03 -0500
|
|
Subject: [PATCH] libmultipath: fix set_int error path
|
|
|
|
set_int() wasn't checking if the line actually had a value before
|
|
converting it to an integer. Found by coverity. Also, it should
|
|
be using set_value().
|
|
|
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/dict.c | 5 ++++-
|
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
|
index 32524d5f..bf4701ee 100644
|
|
--- a/libmultipath/dict.c
|
|
+++ b/libmultipath/dict.c
|
|
@@ -33,7 +33,10 @@ set_int(vector strvec, void *ptr)
|
|
int *int_ptr = (int *)ptr;
|
|
char * buff;
|
|
|
|
- buff = VECTOR_SLOT(strvec, 1);
|
|
+ buff = set_value(strvec);
|
|
+ if (!buff)
|
|
+ return 1;
|
|
+
|
|
*int_ptr = atoi(buff);
|
|
|
|
return 0;
|
|
--
|
|
2.11.0
|
|
|