Просмотр исходного кода

Fix a memory violation in objdb (caught by valgrind)

If the new length is larger then memory will be overwritten.

I could make this ">=" but we can save memory if the new size is smaller by using "!=".



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1680 fd59a12c-fef9-0310-b244-a6a79926bd2f
Angus Salkeld 17 лет назад
Родитель
Сommit
3bc868eb54
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      exec/objdb.c

+ 1 - 1
exec/objdb.c

@@ -1085,7 +1085,7 @@ static int object_key_replace (
 			}
 		}
 
-		if (new_value_len <= object_key->value_len) {
+		if (new_value_len != object_key->value_len) {
 			void *replacement_value;
 			replacement_value = malloc(new_value_len);
 			if (!replacement_value)