Page MenuHomeFreeBSD

[fgetstr] Handle case if len is negative
AbandonedPublic

Authored by gfunni234_gmail.com on Aug 24 2021, 6:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 6 2024, 3:27 AM
Unknown Object (File)
Dec 20 2023, 2:57 AM
Unknown Object (File)
Dec 13 2023, 12:06 AM
Unknown Object (File)
Nov 21 2023, 6:20 PM
Unknown Object (File)
Nov 21 2023, 5:57 PM
Unknown Object (File)
Nov 13 2023, 2:45 PM
Unknown Object (File)
Nov 11 2023, 2:49 PM
Unknown Object (File)
Nov 9 2023, 4:27 PM
Subscribers

Details

Reviewers
imp
jrtc27
dim
Summary

This shouldn’t happen, but if it does, it’s good to have a fallback, lest the loop be stuck until an underflow happens.

It’s not as if it won’t be obvious anymore if a bug happens due to a bad input, but the impact should be lessened.

MFC

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

This is now harder to read. If the input size is between INT_MIN (exclusive) and 0 (inclusive) you still overflow buf. If the input is exactly INT_MIN you still have signed integer overflow. This therefore adds nothing of value.