Hello Maintainers,

I was experiencing a bug (URxvt 9.15, OpenBSD 4.9) that would cause garbage
to be appended to strings printed via keysym binds. It was random in it's
behavior and even occasionally caused the program to crash when loading.
The backtrace of which is here: http://pastebin.com/aY2YMugF

Upon investigation I found that it was a string _not_ being properly null
terminated (in spite of the man page suggesting that it might be done
automatically). The fix for this is quite simple...

At rxvt_mbstowcs() in misc.C, the 2 lines

  if ((ssize_t)mbstowcs (r, str, len + 1) < 0)
    *r = 0;

need to be replaced with

  size_t rl = mbstowcs (r, str, len);
  if(rl == (size_t)0) *r = 0;
  else r[rl] = 0;

While I understand this bug may or may not be present on a system depending
on it's implementation of mbstowcs(), it is still a very legitimate bug.

Please patch
Thanks, :-)
Yarin

_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to