story about lost %ebx (stack corruption in inet_aton ?)
Yuriy Tsibizov
Yuriy.Tsibizov at gfk.com
Mon Dec 17 23:51:27 PST 2007
> My first impression was that there is a bug in gcc compiler on 7-BETA
> and 8-CURRENT (i386 only, and only if optimization is enabled), but it
> seems to be incorrect. Most probably source is stack corruption in
> inet_aton()
mistyped, it is inet_network() that fails...
testcase:
#include <sys/cdefs.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <ctype.h>
int main(){
int val;
char s[]="10.10.0.10.0/12"; // four dots here!
char *q;
q = strchr(s,'/');
if (q) {
*q = '\0';
if ((val = inet_network(s)) != INADDR_NONE) {
printf("OK\n");
return (0);
}
printf("q= %08x\n", q);
*q = '/';
}
}
(should be built with -O1 or -O2 to expose that bug)
Yuriy.
More information about the freebsd-current
mailing list