2004-07-09 18:48
by Vasil KolevSome moments ago I fought with a stupid mistake… How haven’t I fixed that before, I have no idea.
It was in qmail with a patch for mysql support. The problem was in this line:
pw = (struct passwd *) malloc(sizeof(struct passwd *));
And of course, malloc does what we tell him, not what we want, and allocates 4 bytes. After that the program starts accessing the structure’s fields and BOOM…
I should mention, that if I hadn’t used indent to fix the source, to be able to see what does it do (2 spaces tabulation DOESN’T WORK, Bernstein!), I would be probably still banging my head…