Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#66828 - strcpy with realloc

Attached to Project: Pacman
Opened by Sylwester Lunski (woodi) - Friday, 29 May 2020, 14:51 GMT
Last edited by Allan McRae (Allan) - Tuesday, 29 December 2020, 13:23 GMT
Task Type Bug Report
Category General
Status Assigned
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 5.2.1
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Summary and Info:

Pacman source code:

file src/pacman/util.c line 1241 and 1242:

optstring = realloc(optstring, strlen(optstring) + strlen(status) + 1);
strcpy(optstring + strlen(optstring), status);

No realloc error checking.

Also, using strcpy in pacman/libalpm is not very good sign.

Steps to Reproduce:

None yet but should "work" in low memory conditions.
This task depends upon