Skip to content

Commit 1baeac2

Browse files
committed
readtags: exit if memory exhaustion is predicted
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent c49cec4 commit 1baeac2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

extra-cmds/readtags-cmd.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,10 @@ void tagEntryArrayPush (struct tagEntryArray *a, tagEntry *e)
163163
{
164164
if (a->count + 1 == a->length)
165165
{
166-
if (a->length * 2 < a->length)
167-
perror("Too large array allocation");
166+
if (a->length * 2 < a->length) {
167+
fprintf(stderr, "too large array allocation");
168+
exit(1);
169+
}
168170

169171
struct tagEntryHolder *tmp = eRealloc (a->a, sizeof (a->a[0]) * (a->length * 2));
170172
a->a = tmp;

0 commit comments

Comments
 (0)