Thursday, September 16, 2021

Re: editors/nedit: avoid *printf %n

+Cc: MAINTAINER

Hi Theo,

Theo Buehler wrote on Wed, Sep 15, 2021 at 11:59:36PM +0200:

> Straightforward.

OK schwarze@.

Given that we are approaching a lock, i don't think you should wait
for feedback from the MAINTAINER.

Alessandro, i suspect buffer overflow issues in util/misc.c,
function CreateGeometryString(). The arguments are (int) and can
likely be provided from outside the program, but the buffer being
printed to is only 24 bytes long. I didn't poke around long enough
to figure out whether this can crash the program (or worse), but as
the MAINTAINER, it might make sense that you have a closer look.
But that seems unrelated to the present patch.

There is much opportunity for additional cleanup to be done upstream:
for example, strcpy(3) in conjunction with pointer arithmetics is all
over the place, and invariants are quite non-obvious if any exist.

Yours,
Ingo

Testing done:
Before:
$ /obin/ncl tmp.txt
Abort trap (core dumped)
$ /obin/nedit -g 80x24+100+100
Abort trap (core dumped)
After:
$ ncl tmp.txt # works
$ nedit -g 80x24+100+100 # works


> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/editors/nedit/Makefile,v
> retrieving revision 1.82
> diff -u -p -r1.82 Makefile
> --- Makefile 12 Apr 2020 14:46:04 -0000 1.82
> +++ Makefile 13 Sep 2021 16:06:53 -0000
> @@ -5,7 +5,7 @@ COMMENT= a fast, compact Motif/X11 plai
> DISTNAME= nedit-5.7
> P_V= 0.5
> EPOCH= 0
> -REVISION = 0
> +REVISION = 1
> DISTFILES= ${DISTNAME}-src${EXTRACT_SUFX} \
> nedit_patterns-${P_V}.tgz:0
>
> Index: patches/patch-source_nc_c
> ===================================================================
> RCS file: /cvs/ports/editors/nedit/patches/patch-source_nc_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-source_nc_c
> --- patches/patch-source_nc_c 28 Feb 2019 23:00:47 -0000 1.2
> +++ patches/patch-source_nc_c 13 Sep 2021 16:04:55 -0000
> @@ -27,3 +27,28 @@ Index: source/nc.c
>

No comments:

Post a Comment