Browse Source

use memcmp instead of str[n]cmp for temp function XXXXXX checking

Rich Felker 12 years ago
parent
commit
8872e4e481
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/temp/mkostemps.c
  2. 1 1
      src/temp/mktemp.c

+ 1 - 1
src/temp/mkostemps.c

@@ -10,7 +10,7 @@ char *__randname(char *);
 int __mkostemps(char *template, int len, int flags)
 {
 	size_t l = strlen(template);
-	if (l<6 || len>l-6 || strncmp(template+l-len-6, "XXXXXX", 6)) {
+	if (l<6 || len>l-6 || memcmp(template+l-len-6, "XXXXXX", 6)) {
 		errno = EINVAL;
 		return -1;
 	}

+ 1 - 1
src/temp/mktemp.c

@@ -11,7 +11,7 @@ char *__mktemp(char *template)
 	size_t l = strlen(template);
 	int retries = 10000;
 
-	if (l < 6 || strcmp(template+l-6, "XXXXXX")) {
+	if (l < 6 || memcmp(template+l-6, "XXXXXX", 6)) {
 		errno = EINVAL;
 		*template = 0;
 		return template;