[BusyBox] bug#1033: Busybox -Sed misinterprets escaped '/'

Michael Peddemors michael at wizard.ca
Wed Aug 30 17:50:57 UTC 2000


Package: Busybox
Version: 1.46
Severity: Critical

Required syntax that previously worked 

echo "/etc/password" | sed -e 's/[^a-z.\/_]//g'

It now fails...
This is also tested as failing 
echo "he/ll" | sed -e 's/\///g'

Have had to go back to using regular sed.
Tried to fix the the function in sed 

Failure is occuring in this function.  It looked correct to me, but obviously 
wasn't working..  Test with fprintf and we only get "he\" as the 'match' 
string, before failing as bad format (interprets the next slash as the end 
slash, which isn't followed by [g|I])

Rewrote the function, and then it incorrectly passed idx and oldidx, fixed 
that, and memcpy failed.

static int index_of_next_unescaped_slash(int idx, const char *str)
{
	do {
		idx++;
		if (str[idx] == 0)
			return -1;
	} while (str[idx] != '/' && str[idx - 1] != '\\');

	return idx;
} as it failed....

That introduced something new into idx values....
Then I got into memcpy seg faults.. So i did something wrong :-)
Have to pass it aff to the bug list.
-- 
--------------------------------------------------------
Michael Peddemors - Senior Consultant
Unix Administration - WebSite Hosting
Network Services - Programming
Wizard Internet Services http://www.wizard.ca
Linux Support Specialist - http://www.linuxmagic.com
--------------------------------------------------------
(604) 589-0037 Beautiful British Columbia, Canada
--------------------------------------------------------






More information about the busybox mailing list