From c76ce51427ae8759b759a2cfda21b4127391a040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Thu, 29 Sep 2022 17:08:14 +0800 Subject: Somehow digest_len is 45 Also, shop_len is calculated. --- shopify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'shopify.c') diff --git a/shopify.c b/shopify.c index a97e777..3d0265a 100644 --- a/shopify.c +++ b/shopify.c @@ -429,6 +429,7 @@ static enum MHD_Result handle_request(void *cls, struct MHD_Connection *con, } free(sig); } else { + shop_len = strlen(shop); unsigned char hs256[hs256_len]; get_hs256(api_secret_key, upload_data, *upload_data_size, hs256, &hs256_len); @@ -436,7 +437,7 @@ static enum MHD_Result handle_request(void *cls, struct MHD_Connection *con, size_t digest_len; l8w8jwt_base64_encode(0, hs256, hs256_len, &digest, &digest_len); - if (strncmp(hmacsha256, digest, digest_len)) { + if (strncmp(hmacsha256, digest, strlen(hmacsha256))) { free(hmacsha256); free(shop); return MHD_NO; -- cgit v1.2.3