Bug#504325: apt: arfile.cc uses strlen where it should use sizeof
Package: apt
Version: 0.7.16+b1
Severity: minor
Tags: patch
In apt-inst/contrib/arfile.cc:99, the available space in the buffer 'S' is computed with "strlen(S)".
I think that shuld be "sizeof(S)", as the content of S is undefined at this point.
This only matters for names longer than 16 characters, and luckily normal .deb files don't have member names that
long, I think.
--- arfile.cc~ 2008-06-10 00:10:08.000000000 +0300
+++ arfile.cc 2008-11-02 22:42:36.000000000 +0200
@@ -96,7 +96,7 @@
char S[300];
unsigned long Len;
if (StrToNum(Head.Name+3,Len,sizeof(Head.Size)-3) == false ||
- Len >= strlen(S))
+ Len >= sizeof(S))
{
delete Memb;
return _error->Error(_("Invalid archive member header"));
-- Package-specific info:
-- (no /etc/apt/preferences present) --
-- (/etc/apt/sources.list present, but not submitted) --
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages apt depends on:
ii debian-archive-keyring 2008.04.16+nmu1 GnuPG archive keys of the Debian a
ii libc6 2.7-15 GNU C Library: Shared libraries
ii libgcc1 1:4.3.2-1 GCC support library
ii libstdc++6 4.3.2-1 The GNU Standard C++ Library v3
apt recommends no packages.
Versions of packages apt suggests:
pn apt-doc <none> (no description available)
ii aptitude 0.4.11.10-1lenny1.1+b1 terminal-based package manager
ii bzip2 1.0.5-1 high-quality block-sorting file co
ii dpkg-dev 1.14.22 Debian package development tools
ii lzma 4.43-14 Compression method of 7z format in
ii synaptic 0.62.1 Graphical package manager
-- no debconf information
Reply to: