Ver Fonte

cmap: Check RO flag in adjust int function

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
Jan Friesse há 14 anos atrás
pai
commit
546aea23cf
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      exec/cmap.c

+ 6 - 1
exec/cmap.c

@@ -338,7 +338,12 @@ static void message_handler_req_lib_cmap_adjust_int(void *conn, const void *mess
 	struct res_lib_cmap_adjust_int res_lib_cmap_adjust_int;
 	cs_error_t ret;
 
-	ret = icmap_adjust_int((char *)req_lib_cmap_adjust_int->key_name.value, req_lib_cmap_adjust_int->step);
+	if (icmap_is_key_ro((char *)req_lib_cmap_adjust_int->key_name.value)) {
+		ret = CS_ERR_ACCESS;
+	} else {
+		ret = icmap_adjust_int((char *)req_lib_cmap_adjust_int->key_name.value,
+		    req_lib_cmap_adjust_int->step);
+	}
 
 	memset(&res_lib_cmap_adjust_int, 0, sizeof(res_lib_cmap_adjust_int));
 	res_lib_cmap_adjust_int.header.size = sizeof(res_lib_cmap_adjust_int);