[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: gEDA: Ancient bug found
[ Ales here, I'm reposting this since majordomo didn't recognize the
e-mail as being subscribed to the geda-dev mailinglist. Sorry this
repost took so long. ]
-- Cut here --
... Your fix assumes sizeof(char) to be one byte. What about this:
return_value = malloc(sizeof(char)*(strlen(string)+1));
Note the extra brackets.
Cheers,
MvdW
- -----Original Message-----
From: Ales Hvezda [mailto:ahvezda@seul.org]
Sent: Sunday, 5 November 2000 7:14
To: geda-dev@geda.seul.org
Subject: gEDA: Ancient bug found
Hi All,
I've been very busy getting everything I've been working on
checked in to CVS. It's all there now. I'll describe it soon (later
today) after I finish updating the documentation (yes that means a
gnetlist.txt :-) (which I had to totally rewrite because it was totally
out of date; no I never released it)
However I found bug (core dumper) which has been in libgeda
since at least 20000220. I'm quite surprised this hasn't shown up till
now. Basically it relates to pushing down into schematics in gschem.
I've already fixed this in CVS, but here is the bug fix for those of
you who don't want to use the bleeding edge CVS version:
In libgeda/src/u_basic.c search for (around line 101):
/* this is going to be extra large, but it's only for temp usage */
/* anyway */
return_value = malloc(sizeof(char)*strlen(string));
For the unbiased viewer there is something missing here, mainly space
for the null character, so make this line:
return_value = malloc(sizeof(char)*strlen(string)+1);
That will fix the core dump I spent a couple hours tracking down.
The comment is also totally wrong which is probably why I never really
examined the line in much detail. Blah, this was particularly annoying
to find since I assumed I had this code debugged.
-Ales
------- End of Forwarded Message