diff mbox series

Fix pointer dereference in verify_val

Message ID 20180906043645.16931-1-honli@redhat.com (mailing list archive)
State Not Applicable
Headers show
Series Fix pointer dereference in verify_val | expand

Commit Message

Honggang LI Sept. 6, 2018, 4:36 a.m. UTC
From: Honggang Li <honli@redhat.com>

If endptr is not NULL, strtoul() stores the address of the first invalid
character in *endptr.

Fixes: 04d2a8be0305 ("osm_prtn_config.c: parse_group_flag log suspicious group flag value")
Signed-off-by: Honggang Li <honli@redhat.com>
---
 opensm/osm_prtn_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hal Rosenstock Sept. 6, 2018, 9:53 a.m. UTC | #1
On 9/6/2018 12:36 AM, Honggang LI wrote:
> From: Honggang Li <honli@redhat.com>
> 
> If endptr is not NULL, strtoul() stores the address of the first invalid
> character in *endptr.
> 
> Fixes: 04d2a8be0305 ("osm_prtn_config.c: parse_group_flag log suspicious group flag value")
> Signed-off-by: Honggang Li <honli@redhat.com>

Thanks. Applied.

-- Hal
diff mbox series

Patch

diff --git a/opensm/osm_prtn_config.c b/opensm/osm_prtn_config.c
index bbd5bcf6..a7293bcb 100644
--- a/opensm/osm_prtn_config.c
+++ b/opensm/osm_prtn_config.c
@@ -271,7 +271,7 @@  static unsigned long int verify_val(unsigned lineno, osm_log_t *p_log,
 {
 	char *end;
 	unsigned long int ret = strtoul(val, &end, 0);
-	if (val && end)
+	if (val && *end)
 		OSM_LOG(p_log, OSM_LOG_VERBOSE,
 			"PARSE WARN: line %d: "
 			"suspicious val=(%s) detected. "