We used to rely on the result from strncmp() without comparing the length of
the strings involved. Even worse, any single-character format specifier would
enable zip-format due to the optional '.'-prefix since the length of the
mask then would become zero.
Noticed-by: Evan Martin <sys@neugierig.org>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
{
const struct snapshot_archive_t* sat;
static const char *delim = " \t,:/|;";
{
const struct snapshot_archive_t* sat;
static const char *delim = " \t,:/|;";
/* favor legacy setting */
if(atoi(str))
/* favor legacy setting */
if(atoi(str))
break;
for(f=0; f<snapshot_archives_len; f++) {
sat = &snapshot_archives[f];
break;
for(f=0; f<snapshot_archives_len; f++) {
sat = &snapshot_archives[f];
- if(!(strncmp(sat->suffix, str, tl) &&
- strncmp(sat->suffix+1, str, tl-1))) {
+ sl = strlen(sat->suffix);
+ if((tl == sl && !strncmp(sat->suffix, str, tl)) ||
+ (tl == sl-1 && !strncmp(sat->suffix+1, str, tl-1))) {