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
diff --git a/sselp.c b/sselp.c
index 362e397..bf7643e 100644
--- a/sselp.c
+++ b/sselp.c
@@ -35,7 +35,7 @@ main(int argc, char *argv[]) {
False, utf8, &type, &fmt, &len, &more, &data);
fwrite(data, 1, len, stdout);
XFree(data);
- off += len;
+ off += len/4;
}
while(more > 0);
putchar('\n');