浏览代码

In MDStringArray() don't call MD5Update() on empty elements of array. This
doesn't change checksum, but could cause memory copy to be called with
zero length and/or NULL source/destination.

Sponsored by: Sippy Software, Inc.
Debugging: mpatrol

Maxim Sobolev 17 年之前
父节点
当前提交
63266ebb7e
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      md5utils.c

+ 2 - 1
md5utils.c

@@ -78,7 +78,8 @@ void MDStringArray (char *dst, str src[], int size)
 		fprintf(stderr, " [%d]\n", sum );	
 #		endif
 */
-  		MDUpdate (&context, s, len);
+		if (len > 0)
+  			MDUpdate (&context, s, len);
   }
   MDFinal (digest, &context);