求教这里两个异常是什么,动态链表的

求教这里两个错误是什么,动态链表的struct RecvLink{char * getgcv_bufstruct RecvLink * next}///////

求教这里两个错误是什么,动态链表的
struct RecvLink
{
char * getgcv_buf;
struct RecvLink * next;
};
/////////////////////////////////////////////////////////////////////////

struct RecvLink * head = NULL;
struct RecvLink * p2 = NULL;
struct RecvLink * p1 = NULL;



p1 = (struct RecvLink *)malloc(sizeof(struct RecvLink));
p1->getgcv_buf = (char *)malloc(strlen(receivebuf));
sprintf(p1->getgcv_buf, "%s", receivebuf);
/*p1->next = NULL;*/
if (c == 1)
{
head = p1;
}
/*head->next = NULL;*/
char * p = p1->getgcv_buf;
printf("RecvList is :%s\n", p);
p2 = p1;
p1 = p2->next;




+getgcv_buf0x00148F30 "1"char*
-next0xCDCDCDCDRecvLink*
+getgcv_buferror: cannot obtain valuechar*
+nexterror: cannot obtain valueRecvLink*
这里两个错误的意思是什么。应该怎么改正???谢谢大神了
[最优解释]
p1->getgcv_buf = (char *)malloc(strlen(receivebuf));
sprintf(p1->getgcv_buf, "%s", receivebuf);
这两句造成内存越界了,getgcv_buf内存大小应为strlen(recvivebuf)+1,字符串后面要有结束符
[其他解释]

引用:
我在head = p1上加的断点


p1->getgcv_buf = (char *)malloc(strlen(receivebuf));
改成p1->getgcv_buf = (char *)malloc(sizeof(receivebuf));试试
[其他解释]
我在head = p1上加的断点
[其他解释]
p1->getgcv_buf = (char *)malloc(strlen(receivebuf));
sprintf(p1->getgcv_buf, "%s", receivebuf);
[其他解释]
引用:
引用:我在head = p1上加的断点

p1->getgcv_buf = (char *)malloc(strlen(receivebuf));
改成p1->getgcv_buf = (char *)malloc(sizeof(receivebuf));试试
 没用- -