strtol(3) can optionally set errno to EINVAL if no conversion could be
performed and FreeBSD (at least) implements thin behaviour. Add an explicit test to detect this situation in Dispatcher::parse_params(). (This behaviour difference is not relevant to other uses of strtol()). This corrects the mishandling of (eg) "CSI m" on FreeBSD. Closes #129 github pull request. [keithw -- also fixes same issue with mosh-server on OS X]
This commit is contained in:
committed by
Keith Winstein
parent
c6751cfb92
commit
fd0ddf0e22
@@ -85,7 +85,7 @@ void Dispatcher::parse_params( void )
|
|||||||
if ( endptr == segment_begin ) {
|
if ( endptr == segment_begin ) {
|
||||||
val = -1;
|
val = -1;
|
||||||
}
|
}
|
||||||
if ( errno == 0 ) {
|
if ( errno == 0 || segment_begin == endptr ) {
|
||||||
parsed_params.push_back( val );
|
parsed_params.push_back( val );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ void Dispatcher::parse_params( void )
|
|||||||
if ( endptr == segment_begin ) {
|
if ( endptr == segment_begin ) {
|
||||||
val = -1;
|
val = -1;
|
||||||
}
|
}
|
||||||
if ( errno == 0 ) {
|
if ( errno == 0 || segment_begin == endptr ) {
|
||||||
parsed_params.push_back( val );
|
parsed_params.push_back( val );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user