From 54f2f0a3e46e4369285be8c25912fd45413114c0 Mon Sep 17 00:00:00 2001 From: Nobuhiro Hayashi Date: Fri, 3 Dec 2010 12:09:09 +0900 Subject: Permit base256 encoded value in the numeric field of tar header. --- apt-pkg/contrib/strutl.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'apt-pkg/contrib/strutl.cc') diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 987f4c3a4..daf87c87f 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -968,6 +968,24 @@ bool StrToNum(const char *Str,unsigned long &Res,unsigned Len,unsigned Base) return true; } /*}}}*/ +// Base256ToNum - Convert a fixed length binary to a number /*{{{*/ +// --------------------------------------------------------------------- +/* This is used in decoding the 256bit encoded fixed length fields in + tar files */ +bool Base256ToNum(const char *Str,unsigned long &Res,unsigned Len) +{ + int i; + if ((Str[0] & 0x80) == 0) + return false; + else + { + Res = Str[0] & 0x7F; + for(i=1; i