• fix ${12345678901234567890} segfault (OOB access / integer overflow)

‣ not like oksh did, but using mksh’s built-in features
• handle suggested __pure additions
• revert cid 1004F7F096867C83CF0
  ‣ always use our wcwidth code
  ‣ only use our strlcpy code if none found
• fix a couple of gcc-snapshot and clang/scan-build warnings
• mksh R49~rc1
This commit is contained in:
tg
2014-01-05 21:57:29 +00:00
parent 2f6fa6fb3d
commit 89e774fd7e
13 changed files with 149 additions and 126 deletions

8
expr.c
View File

@ -2,7 +2,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013
* 2011, 2012, 2013, 2014
* Thorsten Glaser <tg@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.74 2014/01/05 19:11:44 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.75 2014/01/05 21:57:26 tg Exp $");
/* the order of these enums is constrained by the order of opinfo[] */
enum token {
@ -916,7 +916,6 @@ ksh_access(const char *fn, int mode)
return (rv);
}
#ifndef MKSH_mirbsd_wcwidth
/* From: X11/xc/programs/xterm/wcwidth.c,v 1.7 2013/11/30 23:20:03 tg Exp $ */
struct mb_ucsrange {
@ -925,7 +924,7 @@ struct mb_ucsrange {
};
static int mb_ucsbsearch(const struct mb_ucsrange arr[], size_t elems,
unsigned int val);
unsigned int val) MKSH_A_PURE;
/*
* Generated by MirOS: contrib/code/Snippets/eawparse,v 1.2 2013/11/30 13:45:17 tg Exp $
@ -1190,4 +1189,3 @@ utf_wcwidth(unsigned int wc)
return (2);
return (1);
}
#endif