1
0
mirror of https://github.com/golang/go synced 2024-11-25 06:57:58 -07:00

8l: fix ldpe sym name length == 8 strdup incorrect.

R=rsc
CC=golang-dev
https://golang.org/cl/4102043
This commit is contained in:
Wei Guangjing 2011-01-27 08:26:28 -05:00 committed by Russ Cox
parent 5899cab037
commit 354219951e

View File

@ -170,8 +170,10 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
(symbuf[2] == 0) && (symbuf[3] == 0)) {
l = le32(&symbuf[4]);
obj->pesym[i].name = (char*)&obj->snames[l];
} else {
obj->pesym[i].name = strdup((char*)symbuf);
} else { // sym name length <= 8
obj->pesym[i].name = mal(9);
strncpy(obj->pesym[i].name, (char*)symbuf, 8);
obj->pesym[i].name[8] = 0;
}
obj->pesym[i].value = le32(&symbuf[8]);
obj->pesym[i].sectnum = le16(&symbuf[12]);