The MinGW.org Windows System Libraries
リビジョン | f77cb9933d71a75b4764173eafc9dd972e190853 (tree) |
---|---|
日時 | 2019-01-12 05:03:49 |
作者 | Keith Marshall <keith@user...> |
コミッター | Keith Marshall |
Fix a mkstemp() file name generator defect.
@@ -1,5 +1,13 @@ | ||
1 | 1 | 2019-01-11 Keith Marshall <keith@users.osdn.me> |
2 | 2 | |
3 | + Fix a mkstemp() file name generator defect. | |
4 | + | |
5 | + * mingwex/cryptnam.c (crypto_random_filename_char): Revert 2018-09-06 | |
6 | + change; argument type must be unsigned char *, to avoid math errors. | |
7 | + (__mingw_crypto_tmpname): Use explicit casts to resolve type conflicts. | |
8 | + | |
9 | +2019-01-11 Keith Marshall <keith@users.osdn.me> | |
10 | + | |
3 | 11 | Fix a <stdio.h> typedef omission. |
4 | 12 | |
5 | 13 | * include/stdio.h: Adjust comment formatting. |
@@ -10,7 +10,7 @@ | ||
10 | 10 | * $Id$ |
11 | 11 | * |
12 | 12 | * Written by Keith Marshall <keithmarshall@users.sourceforge.net> |
13 | - * Copyright (C) 2013, 2014, 2018, MinGW.org Project. | |
13 | + * Copyright (C) 2013, 2014, 2018, 2019, MinGW.org Project. | |
14 | 14 | * |
15 | 15 | * |
16 | 16 | * Permission is hereby granted, free of charge, to any person obtaining a |
@@ -94,7 +94,8 @@ CRYPTO_INLINE void *crypto_randomize( void *buf, size_t buflen ) | ||
94 | 94 | return NULL; |
95 | 95 | } |
96 | 96 | |
97 | -CRYPTO_INLINE char *crypto_random_filename_char( char *caret ) | |
97 | +CRYPTO_INLINE | |
98 | +unsigned char *crypto_random_filename_char( unsigned char *caret ) | |
98 | 99 | { |
99 | 100 | /* Helper to generate a random sequence of characters, suitable for |
100 | 101 | * use in file names; although there are other valid possibilities, we |
@@ -155,12 +156,12 @@ char *__mingw_crypto_tmpname( char *template ) | ||
155 | 156 | * We begin by locating the position, within the given template, |
156 | 157 | * where the string of six replaceable 'XXXXXX's should begin. |
157 | 158 | */ |
158 | - char *tail = template + strlen( template ) - 6; | |
159 | + unsigned char *tail = (unsigned char *)(template) + strlen( template ) - 6; | |
159 | 160 | |
160 | 161 | /* Provided this appears sane -- i.e. it at least doesn't place the |
161 | 162 | * six character "tail" before the start of the template itself... |
162 | 163 | */ |
163 | - if( tail >= template ) | |
164 | + if( (char *)(tail) >= template ) | |
164 | 165 | { |
165 | 166 | /* ...then, walk over each of the six bytes of the "tail", until |
166 | 167 | * we reach the NUL terminator... |