Re: avoid atoi, when possible; int overflow -> heap corruption

From: Morten Welinder <>
Date: 2006-05-22 23:16:50
> There are about 20 uses of atoi, and most calls can return
> a usable result in spite of an invalid input -- just because
> atoi returns the same thing for "99" as "99-and-any-suffix".
> It would be better not to ignore invalid inputs.

atoi has undefined behaviour for "99-and-any-suffix".  You might
get lucky and get back 99, but you might also get a random value
or a core dump.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at
Received on Mon May 22 23:17:25 2006

This archive was generated by hypermail 2.1.8 : 2006-05-22 23:17:44 EST