From f598c42e2ebae4c6a423a377e3982e2e87c56a0a Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Sun, 15 May 2005 04:51:02 +0000 Subject: [PATCH] fix str2val() --- ipmitool/lib/helper.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ipmitool/lib/helper.c b/ipmitool/lib/helper.c index a10788f..f0a4259 100644 --- a/ipmitool/lib/helper.c +++ b/ipmitool/lib/helper.c @@ -120,12 +120,13 @@ uint16_t str2val(const char *str, const struct valstr *vs) int i = 0; while (vs[i].str != NULL) { - if (!strncasecmp(vs[i].str, str, strlen(str))) + if (!strncasecmp(vs[i].str, str, + __max(strlen(str), strlen(vs[i].str)))) return vs[i].val; i++; } - return 0; + return vs[i].val; } /* ipmi_csum - calculate an ipmi checksum