From 1ffb560b8de53c8439abed14c6669cd13a70b9ac 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: Fri, 16 Sep 2022 08:57:16 +0800 Subject: Move the char * casting when facing gnutls --- base64.h | 6 +++--- shopify.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base64.h b/base64.h index 8533af1..3c735bc 100644 --- a/base64.h +++ b/base64.h @@ -1,11 +1,11 @@ #include -static inline void base64_decode(unsigned char *host, char **decoded_host) +static inline void base64_decode(const char *host, char **decoded_host) { gnutls_datum_t result; gnutls_base64_decode2(&(gnutls_datum_t){ - host, - strlen((const char *)host) + (unsigned char *)host, + strlen(host) }, &result); *decoded_host = malloc(result.size + 1); strlcpy(*decoded_host, (const char *)result.data, result.size + 1); diff --git a/shopify.c b/shopify.c index cb73201..f75b8ac 100644 --- a/shopify.c +++ b/shopify.c @@ -45,7 +45,7 @@ extern inline void crypt_init(); extern inline bool crypt_maccmp(const char *, const char *, const char *); extern inline void crypt_getnonce(char [], const size_t); extern inline bool regex_match(const char *); -extern inline void base64_decode(unsigned char *, char **); +extern inline void base64_decode(const char *, char **); extern inline void config_getscopes(const char *, char **); extern inline void request_init(); extern inline void request_token(const char *, const char *, const char *, @@ -193,7 +193,7 @@ enum MHD_Result shopify_respond(const struct shopify_param params[], sizeof(struct shopify_param), keycmp); bool embedded = param && !strcmp(param->val, "1"); char *decoded_host; - base64_decode((unsigned char *)host, &decoded_host); + base64_decode(host, &decoded_host); int nsessions = 0; while (sessions[nsessions].shop) nsessions++; -- cgit v1.2.3