From 253725ef1f200edd2eb7597de3f1dcda428b097a Mon Sep 17 00:00:00 2001 From: Yan Jun Date: Fri, 27 May 2016 16:26:31 +0800 Subject: [PATCH] rgw/common: fix error return value of hex_to_buf. We should return negative value if error happens, otherwise the caller may run into exceptions. eg, rgw_swift_verify_signed_token will not return as follow: int ret = hex_to_buf(token, p.c_str(), len); if (ret < 0) return ret; Signed-off-by: Yan Jun --- src/rgw/rgw_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 3520b722815cb..1e75ed2846062 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1774,7 +1774,7 @@ static inline int hex_to_buf(const char *hex, char *buf, int len) return -EINVAL; d = hexdigit(*p); if (d < 0) - return -d; + return d; buf[i] += d; i++; p++; -- 2.39.5