Re: [dwm] input status text bug?

From: Sander van Dijk <a.h.vandijk_AT_gmail.com>
Date: Wed, 31 Oct 2007 09:11:58 +0100

On Oct 31, 2007 7:01 AM, Vasil Dimov <vd_AT_freebsd.org> wrote:
> On Tue, Oct 30, 2007 at 23:04:33 -0400, Ritesh Kumar wrote:
> [...]
> > I went through the source code and fixed the status input handling code to
> > make sure it flushes the input status text only if in encounters a '\n'.
> [...]
> > if(FD_ISSET(STDIN_FILENO, &rd)) {
> > - switch(r = read(STDIN_FILENO, inputtext, sizeof inputtext - 1)) {
> > + pos = inputtext[strlen(inputtext)-1] != '\n' ? strlen(inputtext) : 0;
> > + switch(r = read(STDIN_FILENO, &(inputtext[pos]), sizeof inputtext - 1 - pos)) {
> [...]
>
> Hmmz, aren't you trying to calculate strlen() of something undefined
> here?

And also, when inputtext[0] = '\0', where does
inputtext[strlen(inputtext)-1] point to?

Gr. Sander.
Received on Wed Oct 31 2007 - 09:11:58 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:03:35 UTC