aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-05-24 18:53:19 +0100
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-05-26 10:09:13 +0000
commitb8279a6ce1b95e45033a1f722b0bbfcabd037ff8 (patch)
tree5961452d3eff8be22d9269376cf284ebaccb148d /epan
parent8ff24c2b6e95dcff053429db665ad9578cc39508 (diff)
lrexlib: Pacify checkAPIs
Diffstat (limited to 'epan')
-rw-r--r--epan/wslua/lrexlib/common.c4
-rw-r--r--epan/wslua/lrexlib/pcre2/lpcre2.c9
2 files changed, 9 insertions, 4 deletions
diff --git a/epan/wslua/lrexlib/common.c b/epan/wslua/lrexlib/common.c
index 0893651d2a..04cda02edb 100644
--- a/epan/wslua/lrexlib/common.c
+++ b/epan/wslua/lrexlib/common.c
@@ -26,6 +26,8 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <wireshark.h>
+
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
@@ -235,7 +237,7 @@ void bufferZ_putrepstring (TBuffer *BufRep, int reppos, int nsub) {
bufferZ_addlstring (BufRep, p, q - p);
if (q < end) {
if (++q < end) { /* skip % */
- if (isdigit (*q)) {
+ if (g_ascii_isdigit (*q)) {
int num;
*dbuf = *q;
num = strtol (dbuf, NULL, 10);
diff --git a/epan/wslua/lrexlib/pcre2/lpcre2.c b/epan/wslua/lrexlib/pcre2/lpcre2.c
index 65b4b8947b..c17645052d 100644
--- a/epan/wslua/lrexlib/pcre2/lpcre2.c
+++ b/epan/wslua/lrexlib/pcre2/lpcre2.c
@@ -30,6 +30,9 @@
DIAG_OFF_CLANG(shorten-64-to-32)
DIAG_OFF_CLANG(comma)
+#define malloc_free free
+#define rex_atoi atoi
+
#include <stdlib.h>
#include <string.h>
#include <locale.h>
@@ -200,7 +203,7 @@ static void **check_chartables (lua_State *L, int pos) {
static int chartables_gc (lua_State *L) {
void **ud = check_chartables (L, 1);
if (*ud) {
- free (*ud); //### free() should be called only if pcre2_maketables was called with NULL argument
+ malloc_free (*ud); //### free() should be called only if pcre2_maketables was called with NULL argument
*ud = NULL;
}
return 0;
@@ -241,7 +244,7 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TPcre2 **pud) {
if (argC->locale) {
char old_locale[256];
- strcpy (old_locale, setlocale (LC_CTYPE, NULL)); /* store the locale */
+ g_strlcpy (old_locale, setlocale (LC_CTYPE, NULL), sizeof(old_locale)); /* store the locale */
if (NULL == setlocale (LC_CTYPE, argC->locale)) /* set new locale */
return luaL_error (L, "cannot set locale");
ud->tables = pcre2_maketables (NULL); /* make tables with new locale */ //### argument NULL
@@ -495,7 +498,7 @@ static const luaL_Reg r_functions[] = {
REX_API int REX_OPENLIB (lua_State *L) {
char buf_ver[64];
pcre2_config(PCRE2_CONFIG_VERSION, buf_ver);
- if (PCRE2_MAJOR > atoi (buf_ver)) {
+ if (PCRE2_MAJOR > rex_atoi (buf_ver)) {
return luaL_error (L, "%s requires at least version %d of PCRE2 library",
REX_LIBNAME, (int)PCRE2_MAJOR);
}