diff options
Diffstat (limited to 'src/common/server.c')
-rw-r--r-- | src/common/server.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common/server.c b/src/common/server.c index 6c4b3543..360fb2c6 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -1379,15 +1379,21 @@ base64_encode (char *to, char *from, unsigned int len) } if (len) { - char three[3]={0,0,0}; - int i=0; - for (i=0;i<len;i++) + char three[3] = {0,0,0}; + unsigned int i; + for (i = 0; i < len; i++) + { three[i] = *from++; + } three_to_four (three, to); if (len == 1) + { to[2] = to[3] = '='; + } else if (len == 2) + { to[3] = '='; + } to += 4; }; to[0] = 0; |