aboutsummaryrefslogtreecommitdiff
path: root/libraries/pjproject-ring/patches/fix_base64.patch
blob: 70bdd5054df891fc421d848bd9375ca18c6864b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- a/pjlib-util/src/pjlib-util/base64.c	2017-05-03 10:29:07.200417026 -0400
+++ b/pjlib-util/src/pjlib-util/base64.c	2017-05-03 10:28:30.344335390 -0400
@@ -131,7 +131,7 @@
 
     PJ_ASSERT_RETURN(input && out && out_len, PJ_EINVAL);
 
-    while (buf[len-1] == '=' && len)
+    while (len && buf[len-1] == '=')
 	--len;
 
     PJ_ASSERT_RETURN(*out_len >= PJ_BASE64_TO_BASE256_LEN(len), 
@@ -161,7 +161,7 @@
 	out[j++] = (pj_uint8_t)(((c[2] & 0x03)<<6) | (c[3] & 0x3F));
     }
 
-    pj_assert(j < *out_len);
+    pj_assert(j <= *out_len);
     *out_len = j;
 
     return PJ_SUCCESS;