Skip to content

Commit

Permalink
docproc: guard against overflow
Browse files Browse the repository at this point in the history
Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
  • Loading branch information
ZoltanFridrich committed May 13, 2024
1 parent 805d2dd commit 63b476b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/doc/bin/docproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
*/

#define _GNU_SOURCE
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -402,7 +403,8 @@ static void find_all_symbols(char *filename)
do {
while ((ret = read(pipefd[0],
data + data_len,
4096)) > 0) {
4096)) > 0 &&
data_len <= SIZE_MAX - 4096 - (size_t)ret) {
data_len += (size_t)ret;
data = realloc(data, data_len + 4096);
if (!data) {
Expand Down

0 comments on commit 63b476b

Please sign in to comment.