tar2qfile: fixed a bug when file contained in tar is a multiple of 512 bytes
This commit is contained in:
		
							parent
							
								
									8a1f87d0ed
								
							
						
					
					
						commit
						8e853c752c
					
				@ -744,6 +744,7 @@ ustar_rd (int fd, struct file_header * untrusted_hdr, char *buf, struct stat * s
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	// Extract extra padding
 | 
						// Extract extra padding
 | 
				
			||||||
	fprintf(stderr,"Need to remove pad:%ld %ld\n",untrusted_hdr->filelen,BLKMULT-(untrusted_hdr->filelen%BLKMULT));
 | 
						fprintf(stderr,"Need to remove pad:%ld %ld\n",untrusted_hdr->filelen,BLKMULT-(untrusted_hdr->filelen%BLKMULT));
 | 
				
			||||||
 | 
						if (untrusted_hdr->filelen%BLKMULT < BLKMULT)
 | 
				
			||||||
		ret = read(fd, buf, BLKMULT-(untrusted_hdr->filelen%BLKMULT));
 | 
							ret = read(fd, buf, BLKMULT-(untrusted_hdr->filelen%BLKMULT));
 | 
				
			||||||
	fprintf(stderr,"Removed %d bytes of padding\n",ret);
 | 
						fprintf(stderr,"Removed %d bytes of padding\n",ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -814,8 +815,10 @@ int tar_file_processor(int fd, int filter_count, char **filter)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
				// Extract extra padding
 | 
									// Extract extra padding
 | 
				
			||||||
				fprintf(stderr,"Need to remove pad:%ld %ld %ld\n",to_skip,hdr.filelen,BLKMULT-(hdr.filelen%BLKMULT));
 | 
									fprintf(stderr,"Need to remove pad:%ld %ld %ld\n",to_skip,hdr.filelen,BLKMULT-(hdr.filelen%BLKMULT));
 | 
				
			||||||
 | 
									if (hdr.filelen%BLKMULT < BLKMULT) {
 | 
				
			||||||
					ret = read(fd, &buf, BLKMULT-(hdr.filelen%BLKMULT));
 | 
										ret = read(fd, &buf, BLKMULT-(hdr.filelen%BLKMULT));
 | 
				
			||||||
					fprintf(stderr,"Removed %d bytes of padding\n",ret);
 | 
										fprintf(stderr,"Removed %d bytes of padding\n",ret);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				current = NEED_SYNC_TRAIL;
 | 
									current = NEED_SYNC_TRAIL;
 | 
				
			||||||
			} 
 | 
								} 
 | 
				
			||||||
			i++;
 | 
								i++;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user