summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-20 09:58:55 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-09-20 09:58:55 +0800
commitc5b21d0fffb0b556222a6e41e6c7d11f04596859 (patch)
tree81eb5fd4a70ee33309b58f107fd1b2d14d889db7
parent9d3c4f80e22124f66c6a23d79d71ed5a75a8ead4 (diff)
Log nul-terminated data
-rw-r--r--main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/main.c b/main.c
index 9304259..f55221c 100644
--- a/main.c
+++ b/main.c
@@ -4,8 +4,10 @@
static void handle_success(emscripten_fetch_t *fetch)
{
- printf("Finished downloading %llu bytes of %s from URL %s.\n",
- fetch->numBytes, fetch->data, fetch->url);
+ char data[fetch->numBytes + 1];
+ strlcpy(data, fetch->data, fetch->numBytes + 1);
+ printf("Finished downloading %llu bytes of %s from URL %s.\n", fetch->numBytes, data,
+ fetch->url);
emscripten_fetch_close(fetch);
}