[parted-devel] [PATCH 04/14] do not discard bootcode from extended partition
Jim Meyering
jim at meyering.net
Tue Jun 9 09:41:58 UTC 2009
Petr Uzel wrote:
> On Tue, Jun 09, 2009 at 11:06:28AM +0200, Jim Meyering wrote:
>>
>> Take a look, or try to merge and then run the tests,
>> including with valgrind.
>>
>> There may not be an official version-control conflict,
>> but that change would certainly introduce a nasty bug.
>>
>> Quick answer: table is declared like this:
>>
>> DosRawTable table;
>>
>> yet your added ped_device_read call may write >512 bytes
>> (i.e., sector size) into that buffer, thus clobbering the stack.
>
> So without looking into 'next' code, I assume that everything what has
> to be done here is to read the sector into a temporary buffer and then
> memcpy first 512B (or 440B) from that buffer to table, right?
Right. If you want to make this change on next,
you would use the new function, ptt_read_sector,
in libparted/labels/pt-tools.[ch].
There are many similar uses already,
so please follow the examples.
More information about the parted-devel
mailing list