Skip to content

Commit

Permalink
fix: stack-use-after-scope variable ordering (aws#4355)
Browse files Browse the repository at this point in the history
Co-authored-by: Lindsay Stewart <[email protected]>
  • Loading branch information
2 people authored and dougch committed Jan 17, 2024
1 parent eb7371e commit c08937d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tls/s2n_ktls_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ ssize_t s2n_ktls_sendv_with_offset(struct s2n_connection *conn, const struct iov
POSIX_GUARD_RESULT(s2n_sendv_with_offset_total_size(bufs, count_in, offs_in, &total_bytes));
POSIX_GUARD_RESULT(s2n_ktls_check_estimated_record_limit(conn, total_bytes));

DEFER_CLEANUP(struct s2n_blob new_bufs = { 0 }, s2n_free_or_wipe);
/* The order of new_bufs and new_bufs_mem matters. See https://github.com/aws/s2n-tls/issues/4354 */
uint8_t new_bufs_mem[S2N_MAX_STACK_IOVECS_MEM] = { 0 };
DEFER_CLEANUP(struct s2n_blob new_bufs = { 0 }, s2n_free_or_wipe);
POSIX_GUARD(s2n_blob_init(&new_bufs, new_bufs_mem, sizeof(new_bufs_mem)));
if (offs > 0) {
POSIX_GUARD_RESULT(s2n_ktls_update_bufs_with_offset(&bufs, &count, offs, &new_bufs));
Expand Down

0 comments on commit c08937d

Please sign in to comment.