[dev] [sselp] [patch] Offset increment

From: Virgile Andreani <virgile.andreani_AT_anbuco.fr>
Date: Mon, 19 Jan 2015 14:09:06 +0100

Dear suckless developers,

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`.

Sincerely,
Virgile Andreani


Received on Mon Jan 19 2015 - 14:09:06 CET

This archive was generated by hypermail 2.3.0 : Mon Jan 19 2015 - 14:12:07 CET