diff --git a/src/util/tempfile.cpp b/src/util/tempfile.cpp index 3e6fe0a31a0..edf643059f9 100644 --- a/src/util/tempfile.cpp +++ b/src/util/tempfile.cpp @@ -45,7 +45,10 @@ int my_mkstemps(char *template_str, int suffix_len) std::size_t template_length=strlen(template_str); - if(suffix_len+6>template_length) + if(suffix_len<0) + return -1; + + if(static_cast(suffix_len+6)>template_length) return -1; // suffix too long char *XXXXXX_pos=