prevent bufer underflow
walter harms
wharms at bfs.de
Tue Jun 24 07:37:17 UTC 2008
Bernd Petrovitsch wrote:
> On Mon, 2008-06-23 at 17:49 +0200, walter harms wrote:
>> hi list,
>> this patch adds a check that
> ^^^
>> the address p is larger the current buffer adress text when accessing p-1
>> because at begining p==text is possible.
>> the first place have a dot>text (cursor pos) it could be that p=q is assumed
>> no idea if this is true
>>
>> re,
>> wh
>>
>>
>> --- editors/vi_org.c 2008-06-23 17:42:13.000000000 +0200
>> +++ ../vi.c 2008-06-23 17:38:10.000000000 +0200
>> @@ -1659,12 +1659,12 @@
>> cmdcnt = 0;
>> end_cmd_q(); // stop adding to q
>> last_status_cksum = 0; // force status update
>> - if ((p > text) && (p[-1] != '\n') && (dot > text)) {
>> + if ((p[-1] != '\n') && (dot > text)) {
>
> That looks like either your comment above is or the diff command was
> wrong (read: the from-file and to-file interchanged).
>
> Bernd
obviously you are right. fortunately patch has -R (--reverse) option :)
re,
wh
More information about the busybox
mailing list