tobiasschulz / tar-cs

Automatically exported from code.google.com/p/tar-cs
Other
0 stars 0 forks source link

Conversion to INT sometimes fails in TarHeader.UpdateHeaderFromBytes() #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Encoding.ASCII.GetString(buffer, 100, 7) can result in a string with a 
trailing space character. This will result in an error.

Solution:
Add a .Trim() command at the end of the Encoding like in the example below.

Mode = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 100, 7).Trim(), 8);
UserId = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 108, 7).Trim(), 
8);
GroupId = Convert.ToInt32(Encoding.ASCII.GetString(buffer, 116, 7).Trim(), 
8);

What version of the product are you using? On what operating system?
Latest CVN version

Please provide any additional information below.

Creating very big files works perfect now.

Original issue reported on code.google.com by p.platt...@gmail.com on 14 Jan 2010 at 4:25

GoogleCodeExporter commented 9 years ago
It's there now. Thank you. I appreciate any input.

Original comment by vasilt...@gmail.com on 17 Jun 2011 at 8:36