Skip to content

Commit

Permalink
Merge pull request #624 from smcv/ssize-max
Browse files Browse the repository at this point in the history
utils: Don't let ssize_t overflow when reading very large files
  • Loading branch information
smcv authored Mar 26, 2024
2 parents 8653799 + b6bbba5 commit 041e3c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "config.h"

#include "utils.h"
#include <limits.h>
#include <stdint.h>
#include <sys/syscall.h>
#include <sys/socket.h>
Expand Down Expand Up @@ -599,7 +600,7 @@ load_file_data (int fd,
{
if (data_len == data_read + 1)
{
if (data_len > SIZE_MAX / 2)
if (data_len > SSIZE_MAX / 2)
{
errno = EFBIG;
return NULL;
Expand Down

0 comments on commit 041e3c5

Please sign in to comment.