From 63a5d223202d5c41d5c638db146db04a3f094fec Mon Sep 17 00:00:00 2001 From: slguan Date: Thu, 28 Nov 2019 22:29:30 +0800 Subject: [PATCH] fix issue #626 and [TBASE-1192] --- src/modules/http/src/httpAuth.c | 2 ++ src/modules/http/src/httpSession.c | 1 + 2 files changed, 3 insertions(+) diff --git a/src/modules/http/src/httpAuth.c b/src/modules/http/src/httpAuth.c index 9d9ead7324..4503accc0a 100644 --- a/src/modules/http/src/httpAuth.c +++ b/src/modules/http/src/httpAuth.c @@ -50,6 +50,7 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) { return false; } strncpy(pContext->user, base64, (size_t)user_len); + pContext->user[user_len] = 0; char *password = user + 1; int pass_len = (int)((base64 + outlen) - password); @@ -60,6 +61,7 @@ bool httpParseBasicAuthToken(HttpContext *pContext, char *token, int len) { return false; } strncpy(pContext->pass, password, (size_t)pass_len); + pContext->pass[pass_len] = 0; free(base64); httpTrace("context:%p, fd:%d, ip:%s, basic token parsed success, user:%s", pContext, pContext->fd, pContext->ipstr, diff --git a/src/modules/http/src/httpSession.c b/src/modules/http/src/httpSession.c index 5a5a32260f..61f49da7c8 100644 --- a/src/modules/http/src/httpSession.c +++ b/src/modules/http/src/httpSession.c @@ -114,6 +114,7 @@ void httpRestoreSession(HttpContext *pContext) { return; } session->access--; + pContext->session = NULL; httpTrace("context:%p, ip:%s, user:%s, restore session:%p:%p, access:%d, expire:%d", pContext, pContext->ipstr, pContext->user, session, session->taos, session->access, pContext->session->expire); -- GitLab