aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-05-10 13:35:19 -0400
committerRuss Cox <rsc@swtch.com>2008-05-10 13:35:19 -0400
commitada24b4005504a9cc8035987cf5175940ae568a7 (patch)
tree51def5fcbc79322c17ff8eb56c3734dc5a5d7060
parent77809fb0cc7c9ff07f0ecd319240c8e3ee2c9528 (diff)
downloadplan9port-ada24b4005504a9cc8035987cf5175940ae568a7.tar.gz
plan9port-ada24b4005504a9cc8035987cf5175940ae568a7.tar.bz2
plan9port-ada24b4005504a9cc8035987cf5175940ae568a7.zip
misc: array bounds fixes that gcc finds (John Gosset)
-rw-r--r--src/cmd/eqn/main.c2
-rw-r--r--src/cmd/jpg/readgif.c5
-rw-r--r--src/cmd/tapefs/32vfs.c2
-rw-r--r--src/cmd/tapefs/v10fs.c2
-rw-r--r--src/cmd/tapefs/v6fs.c2
-rw-r--r--src/cmd/troff/t10.c2
6 files changed, 6 insertions, 9 deletions
diff --git a/src/cmd/eqn/main.c b/src/cmd/eqn/main.c
index 518c6b94..677fe192 100644
--- a/src/cmd/eqn/main.c
+++ b/src/cmd/eqn/main.c
@@ -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;
diff --git a/src/cmd/jpg/readgif.c b/src/cmd/jpg/readgif.c
index 22a0b68c..22365669 100644
--- a/src/cmd/jpg/readgif.c
+++ b/src/cmd/jpg/readgif.c
@@ -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){
diff --git a/src/cmd/tapefs/32vfs.c b/src/cmd/tapefs/32vfs.c
index adccd590..1d917f82 100644
--- a/src/cmd/tapefs/32vfs.c
+++ b/src/cmd/tapefs/32vfs.c
@@ -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);
}
diff --git a/src/cmd/tapefs/v10fs.c b/src/cmd/tapefs/v10fs.c
index a2f546cd..c2875b84 100644
--- a/src/cmd/tapefs/v10fs.c
+++ b/src/cmd/tapefs/v10fs.c
@@ -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);
}
diff --git a/src/cmd/tapefs/v6fs.c b/src/cmd/tapefs/v6fs.c
index 648c2128..74c6737c 100644
--- a/src/cmd/tapefs/v6fs.c
+++ b/src/cmd/tapefs/v6fs.c
@@ -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);
}
diff --git a/src/cmd/troff/t10.c b/src/cmd/troff/t10.c
index 38090eac..b037bdda 100644
--- a/src/cmd/troff/t10.c
+++ b/src/cmd/troff/t10.c
@@ -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;