tmisc: array bounds fixes that gcc finds (John Gosset) - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit ada24b4005504a9cc8035987cf5175940ae568a7
 (DIR) parent 77809fb0cc7c9ff07f0ecd319240c8e3ee2c9528
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Sat, 10 May 2008 13:35:19 -0400
       
       misc: array bounds fixes that gcc finds (John Gosset)
       
       Diffstat:
         M src/cmd/eqn/main.c                  |       2 +-
         M src/cmd/jpg/readgif.c               |       5 +----
         M src/cmd/tapefs/32vfs.c              |       2 +-
         M src/cmd/tapefs/v10fs.c              |       2 +-
         M src/cmd/tapefs/v6fs.c               |       2 +-
         M src/cmd/troff/t10.c                 |       2 +-
       
       6 files changed, 6 insertions(+), 9 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/eqn/main.c b/src/cmd/eqn/main.c
       t@@ -7,7 +7,7 @@
        
        char *version = "version Oct 24, 1991";
        
       -char        in[MAXLINE];        /* input buffer */
       +char        in[MAXLINE+1];        /* input buffer */
        int        noeqn;
        char        *cmdname;
        
 (DIR) diff --git a/src/cmd/jpg/readgif.c b/src/cmd/jpg/readgif.c
       t@@ -351,11 +351,8 @@ skipextension(Header *h)
                }
                if(hsize>0 && Bread(h->fd, h->buf, hsize) != hsize)
                        giferror(h, extreaderr);
       -        if(!hasdata){
       -                if(h->buf[hsize-1] != 0)
       -                        giferror(h, "ReadGIF: bad extension format");
       +        if(!hasdata)
                        return;
       -        }
        
                /* loop counter: Application Extension with NETSCAPE2.0 as string and 1 <loop.count> in data */
                if(type == 0xFF && hsize==11 && memcmp(h->buf, "NETSCAPE2.0", 11)==0){
 (DIR) diff --git a/src/cmd/tapefs/32vfs.c b/src/cmd/tapefs/32vfs.c
       t@@ -93,7 +93,7 @@ popdir(Ram *r)
                                continue;
                        f = iget(ino);
                        strncpy(name, dp->name, VNAMELEN);
       -                name[VNAMELEN+1] = '\0';
       +                name[VNAMELEN] = '\0';
                        f.name = name;
                        popfile(r, f);
                }
 (DIR) diff --git a/src/cmd/tapefs/v10fs.c b/src/cmd/tapefs/v10fs.c
       t@@ -84,7 +84,7 @@ popdir(Ram *r)
                                continue;
                        f = iget(ino);
                        strncpy(name, dp->name, VNAMELEN);
       -                name[VNAMELEN+1] = '\0';
       +                name[VNAMELEN] = '\0';
                        f.name = name;
                        popfile(r, f);
                }
 (DIR) diff --git a/src/cmd/tapefs/v6fs.c b/src/cmd/tapefs/v6fs.c
       t@@ -85,7 +85,7 @@ popdir(Ram *r)
                                continue;
                        f = iget(ino);
                        strncpy(name, dp->name, V6NAMELEN);
       -                name[V6NAMELEN+1] = '\0';
       +                name[V6NAMELEN] = '\0';
                        f.name = name;
                        popfile(r, f);
                }
 (DIR) diff --git a/src/cmd/troff/t10.c b/src/cmd/troff/t10.c
       t@@ -75,7 +75,7 @@ void t_ptinit(void)
                ics = EM;        /* insertion character space */
                for (i = 0; i < (NTAB - 1) && DTAB * (i + 1) < TABMASK; i++)
                        tabtab[i] = DTAB * (i + 1);
       -        tabtab[NTAB] = 0;
       +        tabtab[NTAB-1] = 0;
                pl = 11 * INCH;                        /* paper length */
                po = PO;                /* page offset */
                spacesz = SS;