Переглянути джерело

Check for reserved event ID and return SA_AIS_ERR_INVALID_PARAM.
Bug 694


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@728 fd59a12c-fef9-0310-b244-a6a79926bd2f

Mark Haverkamp 20 роки тому
батько
коміт
dc23389a9a
1 змінених файлів з 13 додано та 0 видалено
  1. 13 0
      lib/evt.c

+ 13 - 0
lib/evt.c

@@ -195,6 +195,15 @@ struct event_data_instance {
 
 #define min(a,b) ((a) < (b) ? (a) : (b))
 
+static inline int is_valid_event_id(SaEvtEventIdT evt_id)
+{
+	if (evt_id > 1000) {
+		return 1;
+	} else {
+		return 0;
+	}
+}
+
 /*
  * Clean up function for an evt instance (saEvtInitialize) handle
  * Not to be confused with event data.
@@ -2080,6 +2089,10 @@ saEvtEventRetentionTimeClear(
 	struct res_evt_event_clear_retentiontime res;
 	struct iovec iov;
 
+	if (!is_valid_event_id(eventId)) {
+		return SA_AIS_ERR_INVALID_PARAM;
+	}
+
 	error = saHandleInstanceGet(&channel_handle_db, channelHandle,
 			(void*)&eci);
 	if (error != SA_AIS_OK) {