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

Łukasz Żak lzak@kplabs.pl
Thu Sep 3 12:14:45 GMT 2020


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.

Regards,
Łukasz Żak

-----Original Message-----
From: Newlib <newlib-bounces@sourceware.org> On Behalf Of Corinna Vinschen via Newlib
Sent: Thursday, September 3, 2020 1:44 PM
To: newlib@sourceware.org
Cc: Corinna Vinschen <vinschen@redhat.com>
Subject: Re: [PATCH] MSP430: Fix message in sbrk.c printing binary character

> >From 36c92acd1d6f4bbce4dccf837bbd249b838cd908 Mon Sep 17 00:00:00 
> >2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Wed, 2 Sep 2020 16:16:55 +0100
> Subject: [PATCH] MSP430: Fix message in sbrk.c printing binary 
> character
> 
> The call to write() in sbrk.c was using the wrong value for the length 
> argument, causing the NUL terminating character of the string to be 
> printed.
> 
> ---
>  libgloss/msp430/sbrk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Pushed.


Thanks,
Corinna



More information about the Newlib mailing list