Name truncation in TarHeader will always throw ArgumentOutOfRangeException #17

Open
opened 2026-01-29 22:03:34 +00:00 by claunia · 1 comment
Owner

Originally created by @SteveXCIV on GitHub (Oct 30, 2014).

The conditional check from lines 65 to 69 of SharpCompress.Common.Tar.Headers.TarHeader will always result in an ArgumentOutOfRangeException on line 67.

The signature is of substring is String.Substring(int startIndex, int length), but this line uses the length of the Name property as the length argument, instead of the difference between length and the start index.

Didn't think this needed it's own fork/merge because it's a one-liner, but I don't know if this usage appears anywhere else.

Originally created by @SteveXCIV on GitHub (Oct 30, 2014). The conditional check from lines 65 to 69 of `SharpCompress.Common.Tar.Headers.TarHeader` will always result in an ArgumentOutOfRangeException on line 67. The signature is of substring is `String.Substring(int startIndex, int length)`, but this line uses the length of the Name property as the length argument, instead of the difference between length and the start index. Didn't think this needed it's own fork/merge because it's a one-liner, but I don't know if this usage appears anywhere else.
Author
Owner

@adamhathcock commented on GitHub (Nov 4, 2014):

If you could do a quick Pull Request, that would be great. I'm just very busy these days and even devoting brain power is rough for me.

@adamhathcock commented on GitHub (Nov 4, 2014): If you could do a quick Pull Request, that would be great. I'm just very busy these days and even devoting brain power is rough for me.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/sharpcompress#17