Thread View: gnu.utils.bug
1 messages
1 total messages
Started by Jonathan I. Kamens
Wed, 30 Dec 1992 08:48
GNU tar gnu.c doesn't check malloc return value
Author: Jonathan I. Kamens
Date: Wed, 30 Dec 1992 08:48
Date: Wed, 30 Dec 1992 08:48
60 lines
1924 bytes
1924 bytes
For GNU tar version 1.11.1.
*** 1.1 1992/12/30 18:44:33
--- gnu.c 1992/12/30 18:47:04
***************
*** 98,111 ****
{
struct dirname *dp;
! dp=(struct dirname *)malloc(sizeof(struct dirname));
! if(!dp)
! abort();
dp->next=dir_list;
dir_list=dp;
dp->dev=dev;
dp->ino=ino;
! dp->name=malloc(strlen(name)+1);
strcpy(dp->name,name);
dp->dir_text=text;
dp->allnew=0;
--- 98,109 ----
{
struct dirname *dp;
! dp=(struct dirname *)ck_malloc(sizeof(struct dirname));
dp->next=dir_list;
dir_list=dp;
dp->dev=dev;
dp->ino=ino;
! dp->name=ck_malloc(strlen(name)+1);
strcpy(dp->name,name);
dp->dir_text=text;
dp->allnew=0;
***************
*** 421,432 ****
n_strs++;
p_buf+=tmp;
}
! vec=(char **)malloc(sizeof(char *)*(n_strs+1));
for(p_vec=vec,p_buf=buf;*p_buf;p_buf+=strlen(p_buf)+1)
*p_vec++= p_buf;
*p_vec= 0;
qsort((PTR)vec,n_strs,sizeof(char *),dirent_cmp);
! new_buf=(char *)malloc(p_buf-buf+2);
for(p_vec=vec,p_buf=new_buf;*p_vec;p_vec++) {
char *p_tmp;
--- 419,430 ----
n_strs++;
p_buf+=tmp;
}
! vec=(char **)ck_malloc(sizeof(char *)*(n_strs+1));
for(p_vec=vec,p_buf=buf;*p_buf;p_buf+=strlen(p_buf)+1)
*p_vec++= p_buf;
*p_vec= 0;
qsort((PTR)vec,n_strs,sizeof(char *),dirent_cmp);
! new_buf=(char *)ck_malloc(p_buf-buf+2);
for(p_vec=vec,p_buf=new_buf;*p_vec;p_vec++) {
char *p_tmp;
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads