summaryrefslogtreecommitdiff
path: root/midtrans.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org>2022-10-05 20:39:39 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <prabowo@darapsa.org>2022-10-05 20:39:39 +0800
commitd9c27a0221964924e77bab695d6c305a811adb73 (patch)
treef1f0cb9dcbe18693a42bc33f0747bc71c4c90667 /midtrans.c
parent74b5ca99a3ae4672e12b3ac4bdbfe369f1f58733 (diff)
Make it portable to glibc
Diffstat (limited to 'midtrans.c')
-rw-r--r--midtrans.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midtrans.c b/midtrans.c
index 1c0d99a..653506c 100644
--- a/midtrans.c
+++ b/midtrans.c
@@ -65,7 +65,8 @@ void midtrans_init(const char *api_key, const char *cainfo)
char *pp;
long base64_len = BIO_get_mem_data(b64, &pp) - 1;
char base64[base64_len + 1];
- strlcpy(base64, pp, base64_len + 1);
+ strncpy(base64, pp, base64_len);
+ base64[base64_len] = '\0';
BIO_free_all(b64);
static const char *hdr_tmpl = "Authorization: Basic %s";