From 49142eab8569a09922caaaa3a6de6c3c523e9f86 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Thu, 24 Oct 2019 04:12:38 +0000 Subject: [PATCH] MFC r352420: loader_4th: scan_buffer can leave empty string on stack When the file processing is done, we will have string with lenght 0 in stack and we will attempt to allocate 0 bytes. --- stand/forth/support.4th | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/forth/support.4th b/stand/forth/support.4th index aa50b3bb3a9..64c71e12ec2 100644 --- a/stand/forth/support.4th +++ b/stand/forth/support.4th @@ -363,6 +363,7 @@ variable fd ; : line_buffer_resize ( len -- len ) + dup 0= if exit then >r line_buffer .len @ if line_buffer .addr @ @@ -376,6 +377,7 @@ variable fd ; : append_to_line_buffer ( addr len -- ) + dup 0= if 2drop exit then line_buffer strget 2swap strcat line_buffer .len ! -- 2.45.0