Skip to content

Commit 39324fc

Browse files
committed
repo_arch: limit the package entry size
1 parent c2ace5e commit 39324fc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ext/repo_arch.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#include "tarhead.h"
2424
#include "repo_arch.h"
2525

26+
#define MAX_ENTRY_SIZE 0x1000000
27+
2628
static Offset
2729
adddep(Repo *repo, Offset olddeps, char *line)
2830
{
@@ -98,7 +100,7 @@ repo_add_arch_pkg(Repo *repo, const char *fn, int flags)
98100
tarhead_init(&th, fp);
99101
while (tarhead_next(&th) > 0)
100102
{
101-
if (th.type != 1 || strcmp(th.path, ".PKGINFO") != 0)
103+
if (th.type != 1 || strcmp(th.path, ".PKGINFO") != 0 || th.length > MAX_ENTRY_SIZE)
102104
{
103105
tarhead_skip(&th);
104106
continue;
@@ -467,7 +469,7 @@ repo_add_arch_repo(Repo *repo, FILE *fp, int flags)
467469
while (tarhead_next(&th) > 0)
468470
{
469471
char *bn;
470-
if (th.type != 1)
472+
if (th.type != 1 || th.length > MAX_ENTRY_SIZE)
471473
{
472474
tarhead_skip(&th);
473475
continue;

0 commit comments

Comments
 (0)