Skip to content

Commit

Permalink
tmread: try different fix for error
Browse files Browse the repository at this point in the history
tmread.c: In function ‘__libc_termios_insert_editline’:
tmread.c:461:50: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  461 |                   __libc_tty_editline.flag[pcol] = _TTY_EDITLINE_SINGLE;
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from ../../../../include/libc/file.h:12,
                 from tmread.c:20:
../../../../include/libc/ttyprvt.h:54:8: note: at offset [-2147483648, -1] into destination object ‘flag’ of size 1024
   54 |   char flag[_TTY_EDITLINE_SIZE];
  • Loading branch information
stsp committed Oct 23, 2024
1 parent 09a4227 commit dfaf89c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libc/posix/termios/tmread.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ static void
__libc_termios_insert_editline (unsigned char ch)
{
int mbsize;
int col;
unsigned int col;

col = __libc_tty_editline.col;
if (col >= _TTY_EDITLINE_SIZE)
Expand Down Expand Up @@ -424,7 +424,7 @@ __libc_termios_insert_editline (unsigned char ch)
}
else
{
int pcol;
unsigned int pcol;

/* look for non fixed flag */
pcol = col;
Expand All @@ -450,7 +450,7 @@ __libc_termios_insert_editline (unsigned char ch)
}
else
{
if ((col - pcol + 1) > MB_CUR_MAX)
if ((col - pcol + 1) > (unsigned)MB_CUR_MAX)
{
/* it's terrible... */
while (pcol <= col)
Expand Down

0 comments on commit dfaf89c

Please sign in to comment.