diff options
| author | Sam Varshavchik | 2018-06-25 17:34:33 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2018-06-25 17:34:33 -0400 | 
| commit | 4c78ff960c041b02f47f029aa39eed0c2750ac05 (patch) | |
| tree | c388e102c35a6cefecd768f977f9741528cef1b6 | |
| parent | 778d07bc34d03e4ad77e7438898a54f3dbb2e31a (diff) | |
| download | courier-libs-4c78ff960c041b02f47f029aa39eed0c2750ac05.tar.bz2 | |
reformime: fix crash when -x/-X is specified without a -s.
| -rw-r--r-- | rfc2045/reformime.c | 5 | ||||
| -rw-r--r-- | rfc2045/testsuitemm | 21 | ||||
| -rw-r--r-- | rfc2045/testsuitemm.txt | 5 | 
3 files changed, 29 insertions, 2 deletions
| diff --git a/rfc2045/reformime.c b/rfc2045/reformime.c index 4d1fb67..a47eabf 100644 --- a/rfc2045/reformime.c +++ b/rfc2045/reformime.c @@ -1179,11 +1179,12 @@ int rc=0;  		dsn(p, dodsn == 2);  	else if (do_extract)  	{ -		mimesection = strtok(section,","); +		mimesection = section ? strtok(section, ","):NULL;  		do {  			extract_section(p, mimesection, extract_filename,  					argc-argn, argv+argn, do_extract); -			mimesection = strtok(NULL,","); +			if (mimesection) +				mimesection = strtok(NULL,",");  		} while (mimesection != NULL);  	}  	else if (dovalidate) diff --git a/rfc2045/testsuitemm b/rfc2045/testsuitemm index 8b861b7..585b868 100644 --- a/rfc2045/testsuitemm +++ b/rfc2045/testsuitemm @@ -55,3 +55,24 @@ rm -f confmdtest  ./reformime -o 'дададададададададада foo bar дададададададададада'  ./reformime -h '=?UTF-8?B?0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsA==?= foo bar =?UTF-8?B?0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsA==?=' +cat >testsuite.msg <<EOF +Mime-Version: 1.0 +Content-Type: multipart/mixed; boundary=xx + +--xx +Content-Type: text/plain + +section 1 + +--xx +Content-Type text/plain + +section 2 + +--xx-- +EOF +echo "" +./reformime -X -s1.1 `which cat` <testsuite.msg +./reformime -X -s1.2 `which cat` <testsuite.msg +./reformime -X `which cat` <testsuite.msg +rm -f testsuite.msg diff --git a/rfc2045/testsuitemm.txt b/rfc2045/testsuitemm.txt index a68e3b9..04e31d2 100644 --- a/rfc2045/testsuitemm.txt +++ b/rfc2045/testsuitemm.txt @@ -71,3 +71,8 @@ qcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqcOpw6nDqQo=  дададададададададада foo дададададададададада  =?UTF-8?B?0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsA==?= foo bar =?UTF-8?B?0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsNC00LDQtNCw0LTQsA==?=  дададададададададада foo bar дададададададададада + +section 1 +section 2 +section 1 +section 2 | 
