--- genext2fs.c.orig Mon Apr 14 15:59:56 2003 +++ genext2fs.c Mon Apr 14 16:00:09 2003 @@ -996,6 +996,7 @@ uint32 mklink_fs(filesystem *fs, uint32 strncpy((char*)get_nod(fs, nod)->i_block, (char*)b, size); return nod; } + *((char*)b + size) = '\0'; extend_blk(fs, nod, b, rndup(size, BLOCKSIZE) / BLOCKSIZE); return nod; } @@ -1163,7 +1164,7 @@ void add2fs_from_dir(filesystem *fs, uin add2dir(fs, this_nod, nod, dent->d_name); break; case S_IFLNK: - if(!(b = (uint8*)malloc(rndup(st.st_size, BLOCKSIZE)))) + if(!(b = (uint8*)malloc(rndup(st.st_size + 1, BLOCKSIZE)))) errexit("out of memory"); if(readlink(dent->d_name, (char*)b, st.st_size) < 0) pexit(dent->d_name);