HomeFreeBSD

Stop parsing digits if the value already exceeds USHRT_MAX.

Description

Stop parsing digits if the value already exceeds USHRT_MAX.

There is no need for us to support parsing values that are larger than
the maximum terminal window size. In this case that would be the maximum
of unsigned short.

The problem with parsing larger values is that they can cause integer
overflows when adjusting the cursor position, leading to all sorts of
failing assertions.

PR: 202326
Reported by: kcwu csie org
MFC after: 1 month

Details

Provenance
edAuthored on
Parents
rS286797: Add missing 'static' keyword to keep build at WARNS=6 happy.
Branches
Unknown
Tags
Unknown