Fixed UUE multisection decoding

This commit is contained in:
Ianos Gnatiuc
2006-12-05 19:32:15 +00:00
parent 67194e2060
commit 5ed68936ee
3 changed files with 15 additions and 1 deletions

View File

@@ -54,6 +54,7 @@
#include <gdefs.h>
#include <gctype.h>
#include <gcrcall.h>
#include <gregex.h>
#include <uudeview.h>
#include <uuint.h>
#include <fptools.h>
@@ -942,6 +943,10 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
*state = BEGIN;
}
gregex regexp1, regexp2;
regexp1.compile("sum -r/size [0-9]+/[0-9]+ section.*", gregex::extended | gregex::icase);
regexp2.compile("section [0-9]+ end.*", gregex::extended | gregex::icase);
bool endsection = false;
while (!feof(datain) && (*state != DONE) &&
@@ -959,7 +964,7 @@ UUDecodePart (FILE *datain, FILE *dataout, int *state,
return UURET_IOERR;
}
if ((method == UU_ENCODED) && !strncmp(line, "sum -r/size ", 12))
if ((method == UU_ENCODED) && (regexp1.match(line) || regexp2.match(line)))
{
endsection = true;
}