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 <stewart.r.lindsay@gmail.com>
  • Loading branch information
jmayclin and lrstewart committed Jan 10, 2024
1 parent edebdae commit 35c9f18
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 35c9f18

Please sign in to comment.