sscanf can return EOF on error, so check that we get a result instead. (cherry picked from commit a44311428a99003d4d40591cdb023c6d253efd94)