avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [bug #22800] sprintf() expands a 128char string parameter


From: Joerg Wunsch
Subject: [avr-libc-dev] [bug #22800] sprintf() expands a 128char string parameter incorrectly
Date: Tue, 01 Apr 2008 20:37:00 +0000
User-agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.13) Gecko/20070224 Galeon/2.0.3

Update of bug #22800 (project avr-libc):

             Assigned to:                    None => dmix                   

    _______________________________________________________

Follow-up Comment #1:

Dmitry, can you check this, please?

I think this is a bug somewhere in the following snippet:

              case 's':
                pnt = va_arg (ap, char *);
                size = strnlen (pnt, (flags & FL_PREC) ? prec : ~0);
              no_pgmstring:
                flags &= ~FL_PGMSTRING;
                goto str_lpad;

              case 'S':
                pnt = va_arg (ap, char *);
                size = strnlen_P (pnt, (flags & FL_PREC) ? prec : ~0);
                flags |= FL_PGMSTRING;

              str_lpad:
                if (!(flags & FL_LPAD)) {
                    while (size < width) {
                        putc (' ', stream);
                        width--;
                    }
                }
                while (size) {
                    putc (GETBYTE (flags, FL_PGMSTRING, pnt), stream);
                    if (width) width -= 1;
                    size -= 1;
                }

My guess is that width has to be declared as uint16_t rather
than unsigned char.  What do you think?

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?22800>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]