Changeset dd50aa19 in mainline for uspace/app/tester/print/print2.c

Timestamp:
2024-09-12T12:35:23Z (8 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
899bdfd
Parents:
2ee6351
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-09-11 13:51:11)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-09-12 12:35:23)
Message:

Allocation function tweaks

  • Add reallocarray() from POSIX 2024 for overflow-safe reallocations.
  • Make realloc(x, 0) act as realloc(x, 1), and print an error message because it's unspecified behavior. Previous handling of realloc(x, 0) as free(x) is problematic, because proper realloc use will mistake it for failure if the case isn't specifically checked for, leading to double-free.
  • Make malloc(0) act as malloc(1), since it "just works" when code forgets to specifically check for zero in cases where zero length is meaningful.
(No files)

Note: See TracChangeset for help on using the changeset viewer.