[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Nasty off by one bug in gdomap.c
From: |
Wim Oudshoorn |
Subject: |
Re: Nasty off by one bug in gdomap.c |
Date: |
Wed, 16 Jun 2004 16:47:13 +0200 |
User-agent: |
Mutt/1.4.1i |
On Wed, Jun 16, 2004 at 04:27:56PM +0200, Wim Oudshoorn wrote:
> We encountered random crashes in gdomap (after extensive use).
> After some investigation it turned out there is a off by one
> bug in gdomap.c.
> The bug is in the function: map_add
The fix proposed in the previous mail is wrong.
It will solve the problem but the off by one was somewhere else.
So now I will commit the patch attached below to fix my fix and the
original problem :-)
> I will commit the following patch immediately.
This should teach me not to commit patches too quickly :-(
Wim Oudshoorn.
pcl-cvs: descending directory Tools/
Index: gdomap.c
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Tools/gdomap.c,v
retrieving revision 1.84
diff -u -r1.84 gdomap.c
--- gdomap.c 16 Jun 2004 14:31:54 -0000 1.84
+++ gdomap.c 16 Jun 2004 14:43:42 -0000
@@ -655,7 +655,7 @@
m->svc = (t & GDO_SVC_MASK);
memcpy(m->name, n, l);
- if (map_used + 1 >= map_size)
+ if (map_used >= map_size)
{
if (map_size)
{
@@ -674,7 +674,7 @@
{
int j;
- for (j = map_used+1; j > i; j--)
+ for (j = map_used; j > i; j--)
{
map[j] = map[j-1];
}