X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fsparse.c;h=4b2f982a8c58f5ebef2b0be28be3f6527a70c070;hb=1a44d77d50f4fb37c0410eed04b82303624ea2ec;hp=9680b6052244cbb0904d5fedf9ba671995cbd1da;hpb=dda6367c9eac71da8f2ab1c60b3df60f19ce4755;p=debian%2Ftar diff --git a/src/sparse.c b/src/sparse.c index 9680b605..4b2f982a 100644 --- a/src/sparse.c +++ b/src/sparse.c @@ -991,7 +991,7 @@ pax_dump_header_1 (struct tar_sparse_file *file) off_t size = 0; struct sp_array *map = file->stat_info->sparse_map; char *save_file_name = file->stat_info->file_name; - + #define COPY_STRING(b,dst,src) do \ { \ char *endp = b->buffer + BLOCKSIZE; \ @@ -1029,8 +1029,11 @@ pax_dump_header_1 (struct tar_sparse_file *file) xheader_store ("GNU.sparse.name", file->stat_info, NULL); xheader_store ("GNU.sparse.realsize", file->stat_info, NULL); - file->stat_info->file_name = xheader_format_name (file->stat_info, - "%d/GNUSparseFile.%p/%f", 0); + file->stat_info->file_name = + xheader_format_name (file->stat_info, "%d/GNUSparseFile.%p/%f", 0); + /* Make sure the created header name is shorter than NAME_FIELD_SIZE: */ + if (strlen (file->stat_info->file_name) > NAME_FIELD_SIZE) + file->stat_info->file_name[NAME_FIELD_SIZE] = 0; blk = start_header (file->stat_info); /* Store the effective (shrunken) file size */