Re: exit(1) pb
On Tue, 26 Jun 2001, Russell Coker wrote:
> Regarding my problem of exit(1) not causing a program to exit, here's
> some further information:
>
> The following code fragment from src/chat.c in the 2001-06-26 release of
> Portslave seems critical to the exit(1) problem I am having. The "return
> 0" statement on line 380 of the file seems to change things somehow. If
> I comment it out then exit(1) will work, if I leave it in then it won't
> work. In this case *expect != 0 so the return 0 code is not being
> called!
>
> /* Empty expects always succeed. */
> if (*expect == 0) {
> nsyslog (LOG_DEBUG, "chat_expect - got it");
> free(s);
> return 0;
> }
>
> Here's the difference that this makes to the assembly code that is
> produced:
>
> --- chat.s.works Tue Jun 26 19:31:48 2001
> +++ chat.s Tue Jun 26 19:32:38 2001
> @@ -1012,7 +1012,8 @@
> addl $-12,%esp
> pushl %esi
> call free@PLT
> - addl $32,%esp
> + xorl %eax,%eax
> + jmp .L502
> .p2align 4,,7
> .L423:
> addl $-12,%esp
This is stack corruption at its finest. Some variable being allocated from
the stack in your function is being overrun.
Have fun tracking it down. :)
Reply to: