]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
audit: fix minor off-by-one
authorEric Blake <eblake@redhat.com>
Thu, 26 May 2011 15:09:42 +0000 (09:09 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 26 May 2011 17:17:55 +0000 (11:17 -0600)
Coverity spotted this off-by-one.  Thankfully, no one in libvirt
was ever calling virAuditSend with an argument of 3.

* src/util/virtaudit.c (virAuditSend): Use correct comparison.

src/util/virtaudit.c

index 2f1a52945287b932b982b10dd0efbbbaa114088e..560f7b7779ec4caf954ab7f48454e9d74f7f92a4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * virtaudit.c: auditing support
  *
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -123,7 +123,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
             [VIR_AUDIT_RECORD_RESOURCE] = AUDIT_VIRT_RESOURCE,
         };
 
-        if (type > ARRAY_CARDINALITY(record_types) || record_types[type] == 0)
+        if (type >= ARRAY_CARDINALITY(record_types) || record_types[type] == 0)
             VIR_WARN("Unknown audit record type %d", type);
         else if (audit_log_user_message(auditfd, record_types[type], str, NULL,
                                         clientaddr, clienttty, success) < 0) {