summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert McQueen <robot101@debian.org>2003-05-26 14:04:53 +0000
committerRobert McQueen <robot101@debian.org>2003-05-26 14:04:53 +0000
commitc22a48153ff0f875baf66240a33c20d2bb54cb2d (patch)
tree0a1d2eab8f3246c1eed054d93a82bb65d978c07a
parent6695da6f6dda3da6dcab243139620bb4768a6286 (diff)
downloadpidgin-c22a48153ff0f875baf66240a33c20d2bb54cb2d.tar.gz
[gaim-migrate @ 5932]
(10:04:36) Robot101: LSchiere: alternative way to deal with the magic number - remove it. doesn't crash when signing on to a HTTP proxy. also resolves the mysterious "unsigned tmp" which appeared a week or few ago.. committer: Luke Schierer <lschiere@pidgin.im>
-rw-r--r--src/proxy.c2
-rw-r--r--src/util.c5
-rw-r--r--src/util.h2
3 files changed, 3 insertions, 6 deletions
diff --git a/src/proxy.c b/src/proxy.c
index 7cf932c591..9da0edad95 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -785,7 +785,7 @@ static void http_canwrite(gpointer data, gint source, GaimInputCondition cond)
if (phb->gpi->proxyuser) {
char *t1, *t2;
t1 = g_strdup_printf("%s:%s", phb->gpi->proxyuser, phb->gpi->proxypass);
- t2 = tobase64(t1, -1);
+ t2 = tobase64(t1, strlen(t1));
g_free(t1);
g_return_if_fail(request_len < sizeof(request));
request_len += g_snprintf(request + request_len, sizeof(request) - request_len, "Proxy-Authorization: Basic %s\r\n", t2);
diff --git a/src/util.c b/src/util.c
index b79e054b3b..6fb0040cbe 100644
--- a/src/util.c
+++ b/src/util.c
@@ -354,10 +354,7 @@ static const char alphabet[] =
char *tobase64(const unsigned char *buf, size_t len)
{
char *s = NULL, *rv = NULL;
- unsigned tmp;
-
- if(len == (size_t)(-1))
- len = strlen(buf);
+ unsigned char tmp;
s = g_malloc((4 * (len + 1)) / 3 + 1);
diff --git a/src/util.h b/src/util.h
index 03007fd455..612d0f080e 100644
--- a/src/util.h
+++ b/src/util.h
@@ -44,7 +44,7 @@ char *normalize(const char *str);
* Converts a string to its base-64 equivalent.
*
* @param buf The data to convert.
- * @param len The length of the data, or -1 if it's a NULL-terminated string.
+ * @param len The length of the data.
*
* @return The base-64 version of @a str.
*