Package: lua5.3 / 5.3.3-1.1

0004-Fix-invalid-pointer-conversions.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
Date: Mon, 19 Dec 2016 16:16:26 +0100
Subject: Fix invalid pointer conversions

---
 src/lobject.c | 2 +-
 src/lstrlib.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lobject.c b/src/lobject.c
index a44b385..9fe441f 100644
--- a/src/lobject.c
+++ b/src/lobject.c
@@ -280,7 +280,7 @@ static const char *l_str2d (const char *s, lua_Number *result) {
   endptr = l_str2dloc(s, result, mode);  /* try to convert */
   if (endptr == NULL) {  /* failed? may be a different locale */
     char buff[L_MAXLENNUM + 1];
-    char *pdot = strchr(s, '.');
+    const char *pdot = strchr(s, '.');
     if (strlen(s) > L_MAXLENNUM || pdot == NULL)
       return NULL;  /* string too long or no dot; fail */
     strcpy(buff, s);  /* copy string to buffer */
diff --git a/src/lstrlib.c b/src/lstrlib.c
index 12264f8..0676cff 100644
--- a/src/lstrlib.c
+++ b/src/lstrlib.c
@@ -933,7 +933,7 @@ static void addquoted (luaL_Buffer *b, const char *s, size_t len) {
 static void checkdp (char *buff, int nb) {
   if (memchr(buff, '.', nb) == NULL) {  /* no dot? */
     char point = lua_getlocaledecpoint();  /* try locale point */
-    char *ppoint = memchr(buff, point, nb);
+    char *ppoint = (char *)memchr(buff, point, nb);
     if (ppoint) *ppoint = '.';  /* change it to a dot */
   }
 }