提交 8872e4e4 编写于 作者: R Rich Felker

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

上级 8d2f8064
...@@ -10,7 +10,7 @@ char *__randname(char *); ...@@ -10,7 +10,7 @@ char *__randname(char *);
int __mkostemps(char *template, int len, int flags) int __mkostemps(char *template, int len, int flags)
{ {
size_t l = strlen(template); 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; errno = EINVAL;
return -1; return -1;
} }
......
...@@ -11,7 +11,7 @@ char *__mktemp(char *template) ...@@ -11,7 +11,7 @@ char *__mktemp(char *template)
size_t l = strlen(template); size_t l = strlen(template);
int retries = 10000; int retries = 10000;
if (l < 6 || strcmp(template+l-6, "XXXXXX")) { if (l < 6 || memcmp(template+l-6, "XXXXXX", 6)) {
errno = EINVAL; errno = EINVAL;
*template = 0; *template = 0;
return template; return template;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册