Avoid potential negative array index access to cached text.
[LibreOffice.git] / external / libassuan / w32-stdc.patch
blobdef3dea833afe3075fcd2b057c9626dc2005c2e3
1 --- src/assuan-handler.c
2 +++ src/assuan-handler.c
3 @@ -938,7 +938,7 @@
4 #if defined(HAVE_W32CE_SYSTEM)
5 fdarray[n++] = (void*)fileno (ctx->outbound.data.fp);
6 #elif defined(HAVE_W32_SYSTEM)
7 - fdarray[n++] = (void*)_get_osfhandle (fileno (ctx->outbound.data.fp));
8 + fdarray[n++] = (void*)_get_osfhandle (_fileno (ctx->outbound.data.fp));
9 #else
10 fdarray[n++] = fileno (ctx->outbound.data.fp);
11 #endif
12 --- src/assuan-logging.c
13 +++ src/assuan-logging.c
14 @@ -30,10 +30,15 @@
15 # ifdef HAVE_WINSOCK2_H
16 # include <winsock2.h>
17 # endif
18 +# include <process.h>
19 +# define getpid _getpid
20 # include <windows.h>
21 #endif /*HAVE_W32_SYSTEM*/
22 #include <errno.h>
23 #include <ctype.h>
24 +#if defined HAVE_W32_SYSTEM
25 +#define isascii __isascii
26 +#endif
28 #include "assuan-defs.h"
30 --- src/assuan-pipe-connect.c
31 +++ src/assuan-pipe-connect.c
32 @@ -47,6 +47,8 @@
33 # ifdef HAVE_WINSOCK2_H
34 # include <winsock2.h>
35 # endif
36 +# include <process.h>
37 +# define getpid _getpid
38 # include <windows.h>
39 #endif
41 --- src/assuan-socket.c
42 +++ src/assuan-socket.c
43 @@ -27,6 +27,8 @@
44 #include <stdlib.h>
45 #ifdef HAVE_W32_SYSTEM
46 # define WIN32_LEAN_AND_MEAN
47 +# include <process.h>
48 +# define getpid _getpid
49 # include <windows.h>
50 # include <wincrypt.h>
51 #ifndef HAVE_W32CE_SYSTEM
52 --- src/conversion.c
53 +++ src/conversion.c
54 @@ -27,6 +27,9 @@
55 #include <string.h>
56 #include <errno.h>
57 #include <ctype.h>
58 +#if defined HAVE_W32_SYSTEM
59 +#define isascii __isascii
60 +#endif
62 #include "assuan-defs.h"
63 #include "debug.h"
64 --- src/system-w32.c
65 +++ src/system-w32.c
66 @@ -453,7 +453,7 @@
68 /* Dup stderr to /dev/null unless it is in the list of FDs to be
69 passed to the child. */
70 - fd = assuan_fd_from_posix_fd (fileno (stderr));
71 + fd = assuan_fd_from_posix_fd (_fileno (stderr));
72 fdp = fd_child_list;
73 if (fdp)