adamhathcock / sharpcompress

SharpCompress is a fully managed C# library to deal with many compression types and formats.
MIT License
2.28k stars 480 forks source link

Name truncation in TarHeader will always throw ArgumentOutOfRangeException #22

Open SteveXCIV opened 10 years ago

SteveXCIV commented 10 years ago

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.

adamhathcock commented 10 years ago

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.