2019-01-11 Keith Marshall <keith@users.osdn.me>
+ Fix a mkstemp() file name generator defect.
+
+ * mingwex/cryptnam.c (crypto_random_filename_char): Revert 2018-09-06
+ change; argument type must be unsigned char *, to avoid math errors.
+ (__mingw_crypto_tmpname): Use explicit casts to resolve type conflicts.
+
+2019-01-11 Keith Marshall <keith@users.osdn.me>
+
Fix a <stdio.h> typedef omission.
* include/stdio.h: Adjust comment formatting.
* $Id$
*
* Written by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2013, 2014, 2018, MinGW.org Project.
+ * Copyright (C) 2013, 2014, 2018, 2019, MinGW.org Project.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
return NULL;
}
-CRYPTO_INLINE char *crypto_random_filename_char( char *caret )
+CRYPTO_INLINE
+unsigned char *crypto_random_filename_char( unsigned char *caret )
{
/* Helper to generate a random sequence of characters, suitable for
* use in file names; although there are other valid possibilities, we
* We begin by locating the position, within the given template,
* where the string of six replaceable 'XXXXXX's should begin.
*/
- char *tail = template + strlen( template ) - 6;
+ unsigned char *tail = (unsigned char *)(template) + strlen( template ) - 6;
/* Provided this appears sane -- i.e. it at least doesn't place the
* six character "tail" before the start of the template itself...
*/
- if( tail >= template )
+ if( (char *)(tail) >= template )
{
/* ...then, walk over each of the six bytes of the "tail", until
* we reach the NUL terminator...