fix: Shorten the 'name' field in minitar_entry_metadata

Sure, 256 characters might fit in 'path', but because of the way
paths are stored in a tar archive, basenames cannot exceed 100
characters. So, adding space for a null-terminator, this reduces
our 'name' field from 128 bytes to 101.

This change is backwards-compatible since any reasonable application
should not depend on the name field being 128 bytes (this was never
mentioned in any documentation, API.md describes it as 'char[]' without
a fixed length). sizeof(metadata.name) should always be used instead.
This commit is contained in:
apio 2023-02-09 16:41:26 +01:00
parent 320231c70b
commit 85a6d79151
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -55,7 +55,7 @@ struct minitar_entry_internal
struct minitar_entry_metadata struct minitar_entry_metadata
{ {
char path[257]; char path[257];
char name[128]; char name[101];
char link[101]; char link[101];
mode_t mode; mode_t mode;
uid_t uid; uid_t uid;