This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository e16.

View the commit online.

commit 43ef8fcfb6ad299a53df00ef1ab52e078d620895
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Mon Jun 26 06:31:50 2023 +0200

    eesh: Workaround problem with _FORTIFY_SOURCE=3
    
    When using _FORTIFY_SOURCE=3 it appears we get like
    $ eesh a b
    *** buffer overflow detected ***: terminated
    Aborted (core dumped)
    
    The apparently offensive code is correct, so this must be a bug in
    gcc(-13.1.1).
---
 eesh/main.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/eesh/main.c b/eesh/main.c
index 09a4c4f3..c79c8738 100644
--- a/eesh/main.c
+++ b/eesh/main.c
@@ -91,6 +91,7 @@ main(int argc, char **argv)
    char               *command, *s;
    char                mode;
    int                 len, l;
+   const char         *space;
 
    mode = 0;
    display_name = NULL;
@@ -157,6 +158,7 @@ main(int argc, char **argv)
    CommsSend(e, "set version 0.2");
 
    command = NULL;
+   space = "";
    if (i < argc)
      {
 	mode = 1;
@@ -167,13 +169,12 @@ main(int argc, char **argv)
 	     l = strlen(s);
 	     command = EREALLOC(char, command, len + l + 4);
 
-	     if (len)
-		command[len++] = ' ';
 	     if (strchr(s, ' '))
-		l = snprintf(command + len, l + 4, "'%s'", s);
+		l = snprintf(command + len, l + 4, "%s'%s'", space, s);
 	     else
-		l = snprintf(command + len, l + 4, "%s", s);
+		l = snprintf(command + len, l + 4, "%s%s", space, s);
 	     len += l;
+	     space = " ";
 	  }
      }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to