1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

Another round of tweaks

Notable changes:
- Change a bunch of uses of memcmp(3) to compare strings (which can
  cause buffer read overflows) to strncmp(3).
- src/cmd/ksh93/include/name.h: Eliminate redundant Nambfp_f type.
  Replace with Shbltin_f type from libast's shcmd.h. Since that is
  not guaranteed to be included here, repeat the type definition
  here without fully defining the struct (which is valid in C).
This commit is contained in:
Martijn Dekker 2022-06-24 15:25:05 +01:00
parent da97587e9e
commit cc1689849e
21 changed files with 47 additions and 50 deletions

View file

@ -31,7 +31,8 @@
#include <ast.h>
#include <cdt.h>
typedef int (*Nambfp_f)(int, char**, void*);
typedef struct Shbltin_s Shbltin_t;
typedef int (*Shbltin_f)(int, char**, Shbltin_t*);
/* Nodes can have all kinds of values */
union Value
@ -54,7 +55,7 @@ union Value
struct Ufunction *rp; /* shell user defined functions */
struct Namfun *funp; /* discipline pointer */
struct Namref *nrp; /* name reference */
Nambfp_f bfp; /* builtin entry point function pointer */
Shbltin_f bfp; /* builtin entry point function pointer */
};
#include "nval.h"
@ -149,7 +150,7 @@ struct Ufunction
#define is_abuiltin(n) (nv_isattr(n,NV_BLTIN|NV_INTEGER)==NV_BLTIN)
#define is_afunction(n) (nv_isattr(n,NV_FUNCTION|NV_REF)==NV_FUNCTION)
#define nv_funtree(n) ((n)->nvalue.rp->ptree)
#define funptr(n) ((Shbltin_f)(n)->nvalue.bfp)
#define funptr(n) ((n)->nvalue.bfp)
/* NAMNOD MACROS */
/* ... for attributes */