fix C array arithmetics

This commit is contained in:
tg
2017-04-28 04:13:19 +00:00
parent dba2efa290
commit 5c2a0a1efc

4
shf.c
View File

@ -25,7 +25,7 @@
#include "sh.h" #include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.88 2017/04/28 03:51:14 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/shf.c,v 1.89 2017/04/28 04:13:19 tg Exp $");
/* flags to shf_emptybuf() */ /* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */ #define EB_READSW 0x01 /* about to switch to reading */
@ -1211,7 +1211,7 @@ set_ifs(const char *s)
{ {
ifs0 = *s; ifs0 = *s;
memcpy(ksh_ctypes, tpl_ctypes, sizeof(tpl_ctypes)); memcpy(ksh_ctypes, tpl_ctypes, sizeof(tpl_ctypes));
memset(ksh_ctypes + sizeof(tpl_ctypes), '\0', memset((char *)ksh_ctypes + sizeof(tpl_ctypes), '\0',
sizeof(ksh_ctypes) - sizeof(tpl_ctypes)); sizeof(ksh_ctypes) - sizeof(tpl_ctypes));
while (*s) while (*s)
ksh_ctypes[rtt2asc(*s++)] |= CiIFS; ksh_ctypes[rtt2asc(*s++)] |= CiIFS;