hi.
i wanted to know why doesn't the scanf functions check for overflow
when reading number. For example scanf("%d" on 32bit machine considers
"1" and "4294967297 " to be the same.
I tracked to code to where the conversion itself happens. Code in
scanfs just ignores return value from conversion procedures.
More info in case of glibc posted here:
AFAIK, implementation doesn't define behavior in case of overflow, so
glibc could consider this error and return errno=ERANGE
i wanted to know why doesn't the scanf functions check for overflow
when reading number. For example scanf("%d" on 32bit machine considers
"1" and "4294967297 " to be the same.
I tracked to code to where the conversion itself happens. Code in
scanfs just ignores return value from conversion procedures.
More info in case of glibc posted here:
AFAIK, implementation doesn't define behavior in case of overflow, so
glibc could consider this error and return errno=ERANGE
Comment