diff --git a/src/config_updater.c b/src/config_updater.c index 98ab3cd5..0ce8807b 100644 --- a/src/config_updater.c +++ b/src/config_updater.c @@ -479,7 +479,7 @@ int config_ensure_keys_and_node_id(const char *filename) { buf_capacity = file_size + 1024; work_buf = u_malloc(buf_capacity); if (!work_buf) { u_free(file_buf); return -1; } - memcpy(work_buf, file_buf, file_size); + memcpy(work_buf, file_buf, file_size + 1); /* Helpers use strchr; preserve the terminating NUL. */ work_len = file_size; u_free(file_buf); file_buf = NULL; }