Closed Buzzzz closed 6 years ago
That old piece of code ... not sure if it's even worth keeping. Did you just stumble upon this or are you actively using editline on a target without strdup()
?
Joachim,
I was just browsing the code and it jumped at me, as I was looking for an alternative To “linenoise” for an embedded SPARC system with RTEMS as the OS.
Jens
OK, according to the RTEMS 5.0.0 POSIX compliance guide it supports strdup()
, so then I'll just remove that code path.
Fixed, in my patch queue pending new completion API (FSF compat)
In src/sysunix.c there is this:
This forgets to malloc the terminating NUL for the string and causes undefined behavior for the subsequent strcpy.
This should be
malloc(strlen(p) + 1);
Note that multiplying by sizeof(char) is considered silly, since it is 1 by definition in the C Standard.