aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlmadsen <lmadsen@f38db490-d61c-443f-a65b-d21fe96a405b>2011-01-17 18:58:13 +0000
committerlmadsen <lmadsen@f38db490-d61c-443f-a65b-d21fe96a405b>2011-01-17 18:58:13 +0000
commit9a463e1202985049415aca230ae8930e14a04dfd (patch)
tree8a81b61f8caebb1933d91a623a2731934c9dc5af
parent08971e0f571156486849714ccf56912a3911afc5 (diff)
AST-2011-001
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.1.21@302146 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--.version2
-rw-r--r--ChangeLog6
-rw-r--r--main/utils.c27
3 files changed, 20 insertions, 15 deletions
diff --git a/.version b/.version
index 2f63109ac..84593bae8 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-1.6.1.20
+1.6.1.21
diff --git a/ChangeLog b/ChangeLog
index 740263bfd..1a42350da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-17 Leif Madsen <lmadsen@digium.com>
+
+ * Asterisk 1.6.1.21 Released.
+
+ * AST-2011-001: Stack buffer overflow in SIP channel driver
+
2010-05-17 Leif Madsen <lmadsen@digium.com>
* Asterisk 1.6.1.20 Released
diff --git a/main/utils.c b/main/utils.c
index 54300a364..eaf452746 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -385,28 +385,27 @@ char *ast_uri_encode(const char *string, char *outbuf, int buflen, int doreserve
char *reserved = ";/?:@&=+$,# "; /* Reserved chars */
const char *ptr = string; /* Start with the string */
- char *out = NULL;
- char *buf = NULL;
+ char *out = outbuf;
- ast_copy_string(outbuf, string, buflen);
-
- /* If there's no characters to convert, just go through and don't do anything */
- while (*ptr) {
+ /* If there's no characters to convert, just go through and copy the string */
+ while (*ptr && out - outbuf < buflen - 1) {
if ((*ptr < 32) || (doreserved && strchr(reserved, *ptr))) {
- /* Oops, we need to start working here */
- if (!buf) {
- buf = outbuf;
- out = buf + (ptr - string) ; /* Set output ptr */
+ if (out - outbuf >= buflen - 3) {
+ break;
}
+
out += sprintf(out, "%%%02x", (unsigned char) *ptr);
- } else if (buf) {
- *out = *ptr; /* Continue copying the string */
+ } else {
+ *out = *ptr; /* copy the character */
out++;
- }
+ }
ptr++;
}
- if (buf)
+
+ if (buflen) {
*out = '\0';
+ }
+
return outbuf;
}