Re: [hackers] [sbase][PATCH v2] tar: sanitize: leading zeros should be recognized
Hi,
On Sat, Feb 10, 2024 at 11:57:38PM +0100, Elie Le Vaillant wrote:
> _AT_@ -399,10 +400,17 @@ sanitize(struct header *h)
> for (i = 0; i < LEN(fields); i++)
> - for (j = 0; j < fields[i].l; j++)
> + for (leading = 1, j = 0; j < fields[i].l; j++)
> if (fields[i].f[j] == ' ')
> - fields[i].f[j] = '\0';
> + fields[i].f[j] = leading ? '0' : '\0';
> + else
> + leading = 0;
> }
What do you think if we move this loop into a function and we use
it in both cases?
Roberto Vargas
Received on Tue Mar 05 2024 - 13:16:36 CET
This archive was generated by hypermail 2.3.0
: Tue Mar 05 2024 - 13:24:38 CET