Re: [dev] [sselp] [patch] Offset increment

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Mon, 2 Feb 2015 22:01:32 +0100

On 19 January 2015 at 14:09, Virgile Andreani
<virgile.andreani_AT_anbuco.fr> wrote:
> Using sselp on a string longer than BUFSIZ currently leads to a
> crash. The reason is that on line 38 of `sselp.c`, `off` should
> not be incremented by the length of a chunk but by `len/4`.
> Indeed, incrementing `off` by 1 skips four characters, not one.
>
> Here is the relevant section of the manpage of XGetWindowProperty:
>
>> N = actual length of the stored property in bytes
>> (even if the format is 16 or 32)
>> I = 4 * long_offset
>> T = N - I
>> L = MINIMUM(T, 4 * long_length)
>> A = N - (I + L)
>>
>> The returned value starts at byte index I in the property
>> (indexing from zero), and its length in bytes is L.
>
> Hence the patch, replacing `len` with `len/4`.

Thanks for spotting. Applied.

BR,
Anselm
Received on Mon Feb 02 2015 - 22:01:32 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 02 2015 - 22:12:06 CET