avoid even the chance at UB, it’s too risky with “postmodern” compilers
This commit is contained in:
6
main.c
6
main.c
@ -34,7 +34,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.318 2016/09/01 12:59:10 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.319 2016/10/22 23:56:50 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -111,10 +111,8 @@ rndsetup(void)
|
|||||||
char *cp;
|
char *cp;
|
||||||
|
|
||||||
cp = alloc(sizeof(*bufptr) - sizeof(ALLOC_ITEM), APERM);
|
cp = alloc(sizeof(*bufptr) - sizeof(ALLOC_ITEM), APERM);
|
||||||
#ifdef DEBUG
|
/* clear the allocated space, for valgrind and to avoid UB */
|
||||||
/* clear the allocated space, for valgrind */
|
|
||||||
memset(cp, 0, sizeof(*bufptr) - sizeof(ALLOC_ITEM));
|
memset(cp, 0, sizeof(*bufptr) - sizeof(ALLOC_ITEM));
|
||||||
#endif
|
|
||||||
/* undo what alloc() did to the malloc result address */
|
/* undo what alloc() did to the malloc result address */
|
||||||
bufptr = (void *)(cp - sizeof(ALLOC_ITEM));
|
bufptr = (void *)(cp - sizeof(ALLOC_ITEM));
|
||||||
/* PIE or something similar provides us with deltas here */
|
/* PIE or something similar provides us with deltas here */
|
||||||
|
6
var.c
6
var.c
@ -28,7 +28,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.207 2016/08/01 21:38:07 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.208 2016/10/22 23:56:50 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -1686,10 +1686,8 @@ rndset(unsigned long v)
|
|||||||
short r;
|
short r;
|
||||||
} z;
|
} z;
|
||||||
|
|
||||||
#ifdef DEBUG
|
/* clear the allocated space, for valgrind and to avoid UB */
|
||||||
/* clear the allocated space, for valgrind */
|
|
||||||
memset(&z, 0, sizeof(z));
|
memset(&z, 0, sizeof(z));
|
||||||
#endif
|
|
||||||
|
|
||||||
h = lcg_state;
|
h = lcg_state;
|
||||||
BAFHFinish_reg(h);
|
BAFHFinish_reg(h);
|
||||||
|
Reference in New Issue
Block a user