[sheepdog] [PATCH stable-0.9 5/7] sheep/http: check correct variable

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Fri Dec 26 05:41:30 CET 2014


From: Bingpeng Zhu <nkuzbp at foxmail.com>

We should check the return pointer of strstr().

[Hitoshi: improve commit log a little bit]

Signed-off-by: Bingpeng Zhu <bingpeng.zbp at alibaba-inc.com>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
 sheep/http/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheep/http/http.c b/sheep/http/http.c
index 5786e90..3f3b5b2 100644
--- a/sheep/http/http.c
+++ b/sheep/http/http.c
@@ -175,7 +175,7 @@ static int request_init_operation(struct http_request *req)
 		char *left, *right, num[64];
 		uint64_t max;
 		left = strstr(p, prefix);
-		if (!p)
+		if (!left)
 			goto invalid_range;
 		right = strchr(left, '-');
 		strncpy(num, left + sizeof(prefix) - 1, right - left);
-- 
1.8.3.2




More information about the sheepdog mailing list