summaryrefslogtreecommitdiff
path: root/dpkg-split
diff options
context:
space:
mode:
authorRaphael Hertzog <hertzog@debian.org>2009-03-23 16:01:22 +0100
committerRaphael Hertzog <hertzog@debian.org>2009-03-27 19:54:41 +0100
commit1e1038d76a201b179f900fcfc442a94e4aa3b3eb (patch)
tree28f152a39e3e1017e8d78d99d034a7b84e3b4919 /dpkg-split
parentda116193fa0ec00f0c477614e5178c874a323753 (diff)
downloaddpkg-1e1038d76a201b179f900fcfc442a94e4aa3b3eb.tar.gz
Global review of error checking associated to strtol functions
Several calls to strtol() or strtoul() are not followed by a proper check that ensures that they have parsed an integer value (and not an empty string).
Diffstat (limited to 'dpkg-split')
-rw-r--r--dpkg-split/info.c2
-rw-r--r--dpkg-split/main.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/dpkg-split/info.c b/dpkg-split/info.c
index 802b58a0b..94cbe8721 100644
--- a/dpkg-split/info.c
+++ b/dpkg-split/info.c
@@ -43,7 +43,7 @@ static unsigned long unsignedlong(const char *value, const char *fn, const char
char *endp;
r= strtoul(value,&endp,10);
- if (*endp)
+ if (value == endp || *endp)
ohshit(_("file `%.250s' is corrupt - bad digit (code %d) in %s"),fn,*endp,what);
return r;
}
diff --git a/dpkg-split/main.c b/dpkg-split/main.c
index 2b49709b2..2b8640a16 100644
--- a/dpkg-split/main.c
+++ b/dpkg-split/main.c
@@ -115,6 +115,8 @@ static void setpartsize(const struct cmdinfo *cip, const char *value) {
char *endp;
newpartsize= strtol(value,&endp,10);
+ if (value == endp || *endp)
+ badusage(_("invalid integer for --%s: `%.250s'"), cip->olong, value);
if (newpartsize <= 0 || newpartsize > (INT_MAX >> 10))
badusage(_("part size is far too large or is not positive"));