]> Nishi Git Mirror - libw3.git/commitdiff
security patch
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Mon, 22 Jan 2024 03:06:37 +0000 (03:06 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Mon, 22 Jan 2024 03:06:37 +0000 (03:06 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@50 d27a3e52-49c5-7645-884c-6793ebffc270

Library/File.c
Library/HTTP.c
W3Version.h.p

index 29a6b33a5a6c43a2829d76753ce2ee49964eba47..be0e9f6773f4fc04ee0c938936f6ed80e5d03e4f 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <stdlib.h>
 #include <stdbool.h>
+#include <string.h>
 #include <stdio.h>
 
 void __W3_File_Request(struct W3* w3){
@@ -29,7 +30,10 @@ void __W3_File_Request(struct W3* w3){
                        void* funcptr = __W3_Get_Event(w3, "data");
                        if(funcptr != NULL){
                                void(*func)(struct W3*, char*, size_t) = (void(*)(struct W3*, char*, size_t))funcptr;
-                               func(w3, buf, len);
+                               char* buffer = malloc(len);
+                               memcpy(buffer, buf, len);
+                               func(w3, buffer, len);
+                               free(buffer);
                        }
                        if(feof(f)) break;
                }
index 1795aff80c80090306db894868b55e13ce50bd44..3d722b51de13bb61c1eb8231166f82246950ace7 100644 (file)
@@ -160,7 +160,10 @@ void __W3_HTTP_Request(struct W3* w3){
                                void* funcptr = __W3_Get_Event(w3, "data");
                                if(funcptr != NULL){
                                        void(*func)(struct W3* w3, char*, size_t) = (void(*)(struct W3* w3, char*, size_t))funcptr;
-                                       func(w3, buf + i, l - i);
+                                       char* buffer = malloc(l - i);
+                                       memcpy(buffer, buf + i, l - i);
+                                       func(w3, buffer, l - i);
+                                       free(buffer);
                                }
                                break;
                        }
index 70a6689e358ef98d1cd6f3bcaa03de01e1b6eef2..d454196b5fbe092210dc10a02a063e03d5df8a88 100644 (file)
@@ -6,7 +6,7 @@
 extern "C" {
 #endif
 
-#define LIBW3_VERSION "1.2A" \
+#define LIBW3_VERSION "1.2B" \
 SUFFIX
 
 #ifdef __cplusplus