This commit is contained in:
cathugger 2018-07-09 16:54:44 +00:00
parent be50d6b929
commit 83a63a30ee
3 changed files with 23 additions and 16 deletions

View File

@ -84,6 +84,9 @@ int base64_valid(const char *src,size_t *count)
for (p = src;base64f[(u8)*p] != 0xFF;++p)
;
for (;*p == '=';++p)
;
if (count)
*count = (size_t) (p - src);
return !*p;

32
main.c
View File

@ -667,22 +667,6 @@ int main(int argc,char **argv)
exit(Q_FAILOPENOUTPUT); // define new err code?
}
filters_prepare();
filters_print();
#ifdef STATISTICS
if (!filters_count() && !reportdelay)
#else
if (!filters_count())
#endif
return 0;
#ifdef EXPANDMASK
if (numwords > 1 && flattened)
fprintf(stderr,"WARNING: -N switch will produce bogus results because we can't know filter width. reconfigure with --enable-besort and recompile.\n");
#endif
if (workdir)
createdir(workdir,1);
@ -720,6 +704,22 @@ int main(int argc,char **argv)
goto done;
}
filters_prepare();
filters_print();
#ifdef STATISTICS
if (!filters_count() && !reportdelay)
#else
if (!filters_count())
#endif
return 0;
#ifdef EXPANDMASK
if (numwords > 1 && flattened)
fprintf(stderr,"WARNING: -N switch will produce bogus results because we can't know filter width. reconfigure with --enable-besort and recompile.\n");
#endif
if (yamloutput)
yamlout_init();

View File

@ -32,6 +32,10 @@ int main(void)
tests0[i].in, buf, tests0[i].out);
return 1;
}
if (!base64_valid(buf,0)) {
printf("encoded data is considered invalid\n");
return 3;
}
r = base64_from((u8 *)buf2, buf, strlen(buf));
buf2[r] = '\0';
if (strcmp(buf2, tests0[i].rev) != 0) {