1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00
cde/src/lib
Martijn Dekker b52edb380c edit: avoid potential crash with overlapping strings
In vi.c, there is a potential use of strcpy(3) on overlapping
strings, which is undefined behaviour:

> 	SHOPT_MULTIBYTE == 0
>
> 	# define gencpy(a,b)  strcpy((char*)(a),(char*)(b))
>
> 		.
> 		.
> 		.
>
> 	if( mode != 'y' )
> 	{
> 		gencpy(cp,cp+nchars);

Thanks to Heiko Berges for the report.

src/cmd/ksh93/edit/{edit,emacs,vi}.c:
- Change almost all use of strcpy(3) to libast strcopy(), which
  is a simple implementation that does not have a problem with
  overlapping strings. Note that the return value is different
  (it returns a pointer to the terminating '\0') but that is not
  relevant in any of these cases.
- Same for strncpy(3) => libast strncopy().

src/lib/libast/string/strcopy.c:
- Backport a couple of cosmetic tweaks from the 93v- beta.
2022-04-21 03:03:04 +02:00
..
libast edit: avoid potential crash with overlapping strings 2022-04-21 03:03:04 +02:00
libcmd Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
libdll Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
libsum Another round of accumulated minor fixes and cleanups 2022-03-11 21:20:32 +01:00
Mamfile Restore full 'bin/package test' functionality 2022-03-11 21:17:03 +01:00