More background info:

----- Forwarded message from John Bowler <[email protected]> -----

From: John Bowler <[email protected]>
Reply-To: [email protected]
Subject: RE: Test images for Debian lenny rc2 available
Date: Tue, 10 Mar 2009 10:52:28 -0700
To: 'Martin Michlmayr' <[email protected]>
Cc: 'Marc Singer' <[email protected]>, 'Rod Whitby' <[email protected]>
X-Mailer: Microsoft Office Outlook 12.0
X-Originating-IP: 74.32.171.36

Try this - it avoids executing devio twice:

sysconf=$(devio "<<$1" '!?b.$4->' cp)

You should get an empty $sysconf (and the whole command will fail with exit
code 1) when it is uninitialized and a correct copy with a "\n" appended for
safety if it is ok.

devio doesn't check the whole length before it reads - it just reads in
blocks - so what is happening at present is that your 'sysconf' variable
ends up 130048 characters long, full of 0xff bytes.  If you make the above
change it quietly rejects any SysConf where the byte count is more than
131068.  You might have one somewhere if somehow someone zapped the first
four bytes on an otherwise ok SysConf, but it's probably the right thing to
reject it if that happened.

John Bowler <[email protected]>

-----Original Message-----
From: Martin Michlmayr [mailto:[email protected]] 
Sent: Tuesday, March 10, 2009 1:28 AM
To: John Bowler
Cc: 'Marc Singer'; 'Rod Whitby'
Subject: Re: Test images for Debian lenny rc2 available

* John Bowler <[email protected]> [2009-03-09 15:51]:
> I'm looking at line 65 of /etc/init.0/sysconfsetup, if you're still using
> that, and it says (on my very old Slug):

No, we're talking about a tool in Debian here, which merely does
    sysconf=$(devio "<<$1" cpb)
to read the sysconf partition.

> I think that all it needs to do is check the length first:
> 
>         devio "<<$sysdev" '!? b$4->' && devio "<<$sysdev" cpb fb1,10 |
> {horrible sed command}
> I.e. check the length to ensure it is not greater than the device
length-4.

That seems to work for me.

So is this the correct fix?
-- 
Martin Michlmayr
http://www.cyrius.com/

----- End forwarded message -----

-- 
Martin Michlmayr
http://www.cyrius.com/



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to