diff --git a/src/uvwasi.c b/src/uvwasi.c index 7c334a7..948c135 100644 --- a/src/uvwasi.c +++ b/src/uvwasi.c @@ -2199,7 +2199,7 @@ uvwasi_errno_t uvwasi_path_readlink(uvwasi_t* uvwasi, memcpy(buf, req.ptr, len); buf[len] = '\0'; - *bufused = len + 1; + *bufused = len; uv_fs_req_cleanup(&req); return UVWASI_ESUCCESS; } diff --git a/test/test-symlink.c b/test/test-symlink.c index cae5cad..a21c500 100644 --- a/test/test-symlink.c +++ b/test/test-symlink.c @@ -56,7 +56,7 @@ int main(void) { strlen(path) + 1, &bufused); assert(err == 0); - assert(bufused == strlen(path) + 1); + assert(bufused == strlen(path)); assert(strcmp(buf, path) == 0); err = uvwasi_path_unlink_file(&uvwasi, 3, linkname, strlen(linkname)); @@ -79,7 +79,7 @@ int main(void) { strlen(truncated_path) + 1, &bufused); assert(err == 0); - assert(bufused == strlen(truncated_path) + 1); + assert(bufused == strlen(truncated_path)); assert(strcmp(buf, truncated_path) == 0); err = uvwasi_path_unlink_file(&uvwasi, 3, truncated_linkname, strlen(truncated_linkname));