use memcmp instead of str[n]cmp for temp function XXXXXX checking
authorRich Felker <dalias@aerifal.cx>
Thu, 21 Feb 2013 04:01:22 +0000 (23:01 -0500)
committerRich Felker <dalias@aerifal.cx>
Thu, 21 Feb 2013 04:01:22 +0000 (23:01 -0500)
src/temp/mkostemps.c
src/temp/mktemp.c

index d87d4b667b752b75a0908ac3280f3065ae0f7d7b..8cc01e37e63a308a9d83f204b425efcffc4b0672 100644 (file)
@@ -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;
        }
index de0f370947bbc666dfd177ca1355f28efc78f195..24c858bb18b21e71f6bdce5e08d09afc11b34b18 100644 (file)
@@ -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;