# fix argsAlloc buffer size · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/69f46cab555edd3fda9012a237aa7f708c144bfe)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 69f46cab555edd3fda9012a237aa7f708c144bfe

Requested commit: 69f46cab555edd3fda9012a237aa7f708c144bfe

Commit: 69f46cab555edd3fda9012a237aa7f708c144bfe

Tree: 5b0880b6d3322b241bc7d5337bd779cfce09efdc

Author: Jean Dao

Committer: Andrew Kelley

## Message

```
fix argsAlloc buffer size

The buffer `buf` contains N (= `slice_sizes.len`) slices followed by the
N null-terminated arguments. The N null-terminated arguments are stored
in the `contents` array list. Thus, `buf` size should be:
    @sizeOf([]u8) * slice_sizes.len + contents_slice.len

Instead of:
    @sizeOf([]u8) * slice_sizes.len + contents_slice.len + slice_sizes.len

This bug was found thanks to the gpa allocator which checks if freed
size matches allocated sizes for large allocations.

```

## Parents

- [452c35656ed51944e164419e545381e889b4deb2](https://git.cafe/gitcafe/zig/commit/452c35656ed51944e164419e545381e889b4deb2?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/69f46cab555edd3fda9012a237aa7f708c144bfe?format=markdown)
