kasjer commented on a change in pull request #2046: base64,stats: add base64 
fixedlen decode,fix stats
URL: https://github.com/apache/mynewt-core/pull/2046#discussion_r335696139
 
 

 ##########
 File path: encoding/base64/src/base64.c
 ##########
 @@ -167,6 +167,29 @@ base64_decode(const char *str, void *data)
     return q - (unsigned char *) data;
 }
 
+int
+base64_decode_maxlen(const char *str, void *data, int len)
+{
+    const char *p;
+    unsigned char *q;
+
+    q = data;
+    for (p = str; *p && (*p == '=' || strchr(base64_chars, *p)); p += 4) {
+        if (q - (unsigned char *)data >= len) {
 
 Review comment:
   It looks like function can write to memory beyond data + len which does not 
seem to be intentional.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to