What about
int main(int argc, char **argv) {
if (argc != 2 || (argv == 2 && !strcmp(argv[1], "--very-magic"))) {
char argv0[512];
memcpy(argv0, 'a', 511);
argv0[511] = 0;
char *const args[] = { argv0, "--very-magic", 0 };
execv(argv[0], args);
}
strcpy(argv[0], "my proggy");
/* your code here */
}
This should ensure that you have 511 bytes of argv[0] storage available,
if I read the previous posts correctly.
For the same effect without the --very-magic argument, you could simply
do an "if (argc != 2 || strlen(argv[0]) != 511)" instead.
Am I smoking crack, or could the above work?
--
................................................................
: jakob@unthought.net : And I see the elder races, :
:.........................: putrid forms of man :
: Jakob Østergaard : See him rise and claim the earth, :
: OZ9ABN : his downfall is at hand. :
:.........................:............{Konkhra}...............:
-
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/