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

totemconfig.c: don't let a key of length > 128 clobber memory

* exec/totemconfig.c (totem_config_keyread): Reject a key with length
greater than that of our private_key buffer.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2038 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
4995054ca2
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      exec/totemconfig.c

+ 3 - 0
exec/totemconfig.c

@@ -677,6 +677,9 @@ int totem_config_keyread (
 			&key_len);
 
 		if (res == 0 && key) {
+			if (key_len > sizeof (totem_config->private_key)) {
+				goto key_error;
+			}
 			memcpy(totem_config->private_key, key, key_len);
 			totem_config->private_key_len = key_len;
 			got_key = 1;