瀏覽代碼

Note that length checking on base64_decode is kinda conservative

svn:r3144
Nick Mathewson 21 年之前
父節點
當前提交
8c85c0bef8
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      src/common/crypto.c

+ 4 - 0
src/common/crypto.c

@@ -1534,6 +1534,10 @@ base64_encode(char *dest, size_t destlen, const char *src, size_t srclen)
  * the result into <b>dest</b>, if it will fit within <b>destlen</b>
  * bytes.  Return the number of bytes written on success; -1 if
  * destlen is too short, or other failure.
+ *
+ * NOTE: destlen should be a little longer than the amount of data it
+ * will contain, since we check for sufficient space conservatively.
+ * Here, "a little" is around 64-ish bytes.
  */
 int
 base64_decode(char *dest, size_t destlen, const char *src, size_t srclen)