check location before dereference

This commit is contained in:
Mark Andrews 2002-05-27 11:37:40 +00:00
parent 5fdea8467e
commit f93fad20d4

View file

@ -48,7 +48,7 @@
* SUCH DAMAGE.
*/
/* $Id: file.c,v 1.44 2002/05/22 05:57:17 marka Exp $ */
/* $Id: file.c,v 1.45 2002/05/27 11:37:40 marka Exp $ */
#include <config.h>
@ -212,7 +212,7 @@ isc_file_renameunique(const char *file, char *templet) {
return (ISC_R_FAILURE);
x = cp--;
while (*cp == 'X' && cp >= templet) {
while (cp >= templet && *cp == 'X') {
isc_random_get(&which);
*cp = alphnum[which % (sizeof(alphnum) - 1)];
x = cp--;
@ -258,7 +258,7 @@ isc_file_openunique(char *templet, FILE **fp) {
return (ISC_R_FAILURE);
x = cp--;
while (*cp == 'X' && cp >= templet) {
while (cp >= templet && *cp == 'X') {
isc_random_get(&which);
*cp = alphnum[which % (sizeof(alphnum) - 1)];
x = cp--;