projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/z80/gen.c (setupPair): Added 'extended stack' support for the z80. Can now...
[fw/sdcc]
/
src
/
SDCCsymt.c
diff --git
a/src/SDCCsymt.c
b/src/SDCCsymt.c
index 433afeafc7ffa0b9cc7147f80f2982896016d46d..de4b9d4b82184df0772590ee07123764807d9e18 100644
(file)
--- a/
src/SDCCsymt.c
+++ b/
src/SDCCsymt.c
@@
-72,7
+72,7
@@
newBucket ()
{
bucket *bp;
{
bucket *bp;
- bp = Safe_
calloc (1,
sizeof (bucket));
+ bp = Safe_
alloc (
sizeof (bucket));
return bp;
}
return bp;
}
@@
-112,10
+112,16
@@
addSym (bucket ** stab,
checkTypeSanity(((symbol *)sym)->etype, ((symbol *)sym)->name);
}
checkTypeSanity(((symbol *)sym)->etype, ((symbol *)sym)->name);
}
+ /* prevent overflow of the (r)name buffers */
+ if (strlen(sname)>SDCC_SYMNAME_MAX) {
+ werror (W_SYMBOL_NAME_TOO_LONG, SDCC_SYMNAME_MAX);
+ sname[SDCC_SYMNAME_MAX]='\0';
+ }
+
/* the symbols are always added at the head of the list */
i = hashKey (sname);
/* get a free entry */
/* the symbols are always added at the head of the list */
i = hashKey (sname);
/* get a free entry */
- bp = Safe_
calloc (1,
sizeof (bucket));
+ bp = Safe_
alloc (
sizeof (bucket));
bp->sym = sym; /* update the symbol pointer */
bp->level = level; /* update the nest level */
bp->sym = sym; /* update the symbol pointer */
bp->level = level; /* update the nest level */
@@
-267,7
+273,7
@@
newSymbol (char *name, int scope)
{
symbol *sym;
{
symbol *sym;
- sym = Safe_
calloc (1,
sizeof (symbol));
+ sym = Safe_
alloc (
sizeof (symbol));
strcpy (sym->name, name); /* copy the name */
sym->level = scope; /* set the level */
strcpy (sym->name, name); /* copy the name */
sym->level = scope; /* set the level */
@@
-284,7
+290,7
@@
newLink ()
{
sym_link *p;
{
sym_link *p;
- p = Safe_
calloc (1,
sizeof (sym_link));
+ p = Safe_
alloc (
sizeof (sym_link));
return p;
}
return p;
}
@@
-297,7
+303,7
@@
newStruct (char *tag)
{
structdef *s;
{
structdef *s;
- s = Safe_
calloc (1,
sizeof (structdef));
+ s = Safe_
alloc (
sizeof (structdef));
strcpy (s->tag, tag); /* copy the tag */
return s;
strcpy (s->tag, tag); /* copy the tag */
return s;
@@
-1423,6
+1429,8
@@
computeType (sym_link * type1, sym_link * type2)
(!IS_LITERAL(type2) && SPEC_USIGN (etype2))) &&
!IS_FLOAT (reType))
SPEC_USIGN (reType) = 1;
(!IS_LITERAL(type2) && SPEC_USIGN (etype2))) &&
!IS_FLOAT (reType))
SPEC_USIGN (reType) = 1;
+ else
+ SPEC_USIGN (reType) = 0;
/* if result is a literal then make not so */
if (IS_LITERAL (reType))
/* if result is a literal then make not so */
if (IS_LITERAL (reType))