[PATCH] MSP430: Fix message in sbrk.c printing binary character

Corinna Vinschen vinschen@redhat.com
Fri Sep 4 13:05:55 GMT 2020


On Sep  3 14:02, Jozef Lawrynowicz wrote:
> On Thu, Sep 03, 2020 at 12:14:45PM +0000, Łukasz Żak wrote:
> > I would like to point out that this patch is in fact incorrect. 
> > 
> > >+      const char * const msg = "Heap and stack collision\n";
> > >+      write (1, msg, sizeof (msg) - 1);
> > 
> > As msg is pointer then sizeof(msg) will be the size of pointer and not the length of the actual string literal, 
> > therefore the write call will capture only the beginning of the message.
> 
> Whoops, my mistake, thanks for spotting that.
> Fixed in the attached patch.
> 
> Thanks,
> Jozef
> 
> > 
> > Regards,
> > Łukasz Żak
> > 

> >From 32a56f154205b179512cfab2a7523fb855898a8a Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Thu, 3 Sep 2020 14:00:32 +0100
> Subject: [PATCH] MSP430: Fix calculation of string length in sbrk.c
> 
> ---
>  libgloss/msp430/sbrk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Pushed.


Thanks,
Corinna



More information about the Newlib mailing list