|
Re: patch to login, dmesg and obscure: msg#00219linux.busybox
> Example: > old = "123" (4 bytes) > wrapped allocated = 3*2 + 1 = 7 bytes. > first initialisez only 4 bytes = "123" > after strcat resut is "123123" - 7 bytes. > Not overflow. This start to be realy fun soon... :-) The litte prog below mimics password_check() behaviour and it sure craches on my machine. Howcome? It shouldn't if you're right. /Ronny ---------------- #include <string.h> #include <stdio.h> #include <stdlib.h> int main(void) { const char *old="0123456789"; char *wrapped; int lenwrap; lenwrap = strlen(old) * 2 + 1; wrapped = malloc(lenwrap); strcpy(wrapped, old); strcat(wrapped, wrapped); printf("wrapped: %s\n", wrapped); free(wrapped); return 0; } |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Some problems with busybox-1.0.0-pre1: 00219, Manuel Novoa III |
|---|---|
| Next by Date: | Re: patch to login, dmesg and obscure: 00219, Vladimir N. Oleynik |
| Previous by Thread: | Re: patch to login, dmesg and obscurei: 00219, Vladimir N. Oleynik |
| Next by Thread: | Re: patch to login, dmesg and obscure: 00219, Vladimir N. Oleynik |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |