No cigar. This stuff is all set up by the kernel on the stack;
in order you have
Top of stack at 0xbfffffff
environ[0]\0environ[1]\0\0 From high ..
argv[0]\0argv[1]\0\0
*environ[];
*argv[]; .. to low.
The kernel only reserves space as needed. If you have an empty
environment, and you copy 512 bytes over argv[0], you'll end
up with a SEGV.
If you want to modify argv[0] etc, loop over argv[], count howmuch
space there is (strlen(argv[0] + 1 + strlen(argv[1] + 1 ... etc)
and make sure you do NOT write a string longer than that. Also
make sure that you end the string with a double \0
Mike.
-- They all laughed when I said I wanted to build a joke-telling machine. Well, I showed them! Nobody's laughing *now*! -- acesteves@clix.pt- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/