Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
aports
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Shkenev
aports
Commits
d7c55cd6
Commit
d7c55cd6
authored
12 years ago
by
Natanael Copa
Browse files
Options
Downloads
Patches
Plain Diff
main/tinyproxy: fix CVE-2012-3505
fixes #1515
parent
02ce8a55
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main/tinyproxy/APKBUILD
+8
-1
8 additions, 1 deletion
main/tinyproxy/APKBUILD
main/tinyproxy/limit_headers.patch
+46
-0
46 additions, 0 deletions
main/tinyproxy/limit_headers.patch
with
54 additions
and
1 deletion
main/tinyproxy/APKBUILD
+
8
−
1
View file @
d7c55cd6
...
...
@@ -2,7 +2,7 @@
# Maintainer: Michael Mason <ms13sp@gmail.com>
pkgname
=
tinyproxy
pkgver
=
1.8.3
pkgrel
=
1
pkgrel
=
2
pkgdesc
=
"Lightweight HTTP proxy"
pkgusers
=
"tinyproxy"
pkggroups
=
"tinyproxy"
...
...
@@ -14,12 +14,18 @@ makedepends="asciidoc"
install
=
"tinyproxy.pre-install"
subpackages
=
"
$pkgname
-doc"
source
=
"https://www.banu.com/pub/
$pkgname
/
${
pkgver
%.*
}
/
$pkgname
-
$pkgver
.tar.bz2
limit_headers.patch
tinyproxy.initd
"
_builddir
=
"
$srcdir
/
$pkgname
-
$pkgver
"
prepare
()
{
cd
"
$_builddir
"
for
i
in
$source
;
do
case
$i
in
*
.patch
)
msg
$i
;
patch
-p1
-i
"
$srcdir
"
/
$i
||
return
1
;;
esac
done
# set default user to tinyproxy:tinyproxy and correct pidfile
sed
-i
-e
's:^User.*:User tinyproxy:'
\
...
...
@@ -47,4 +53,5 @@ package() {
}
md5sums
=
"292ac51da8ad6ae883d4ebf56908400d tinyproxy-1.8.3.tar.bz2
cf72d2503f6415079c4702853d467ea8 limit_headers.patch
ce2b2e3c79fa0e8491fe625bbb15710a tinyproxy.initd"
This diff is collapsed.
Click to expand it.
main/tinyproxy/limit_headers.patch
0 → 100644
+
46
−
0
View file @
d7c55cd6
diff --git a/src/reqs.c b/src/reqs.c
index 2e13f48..ce46bf3 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -641,6 +641,11 @@
add_header_to_connection (hashmap_t hashofheaders, char *header, size_t len)
return hashmap_insert (hashofheaders, header, sep, len);
}
+/* define max number of headers. big enough to handle legitimate cases,
+ * but limited to avoid DoS
+ */
+#define MAX_HEADERS 10000
+
/*
* Read all the headers from the stream
*/
@@ -648,6 +653,7 @@
static int get_all_headers (int fd, hashmap_t hashofheaders)
{
char *line = NULL;
char *header = NULL;
+ int count;
char *tmp;
ssize_t linelen;
ssize_t len = 0;
@@ -656,7 +662,7 @@
static int get_all_headers (int fd, hashmap_t hashofheaders)
assert (fd >= 0);
assert (hashofheaders != NULL);
- for (;;) {
+ for (count = 0; count < MAX_HEADERS; count++) {
if ((linelen = readline (fd, &line)) <= 0) {
safefree (header);
safefree (line);
@@ -722,6 +728,12 @@
static int get_all_headers (int fd, hashmap_t hashofheaders)
safefree (line);
}
+
+ /* if we get there, this is we reached MAX_HEADERS count.
+ bail out with error */
+ safefree (header);
+ safefree (line);
+ return -1;
}
/*
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment