]> wimlib.net Git - wimlib/blobdiff - src/security.c
win32_apply.c: Simplify and fix win32_create_file()
[wimlib] / src / security.c
index 27c68a4ff9663cb5a7a0995da63bae83a3d916da..d5fbcbb7db1d6d75501b4767ceb6924b1349b190 100644 (file)
@@ -52,8 +52,7 @@ new_wim_security_data(void)
  *
  * @metadata_resource: An array that contains the uncompressed metadata
  *                             resource for the WIM image.
- * @metadata_resource_len:     The length of @metadata_resource.  It must be at
- *                             least 8 bytes.
+ * @metadata_resource_len:     The length of @metadata_resource.
  * @sd_ret:    A pointer to a pointer to a wim_security_data structure that
  *             will be filled in with a pointer to a new wim_security_data
  *             structure containing the security data on success.
@@ -78,7 +77,8 @@ read_wim_security_data(const u8 metadata_resource[], size_t metadata_resource_le
        const struct wim_security_data_disk *sd_disk;
        const u8 *p;
 
-       wimlib_assert(metadata_resource_len >= 8);
+       if (metadata_resource_len < 8)
+               return WIMLIB_ERR_INVALID_METADATA_RESOURCE;
 
        sd = new_wim_security_data();
        if (!sd)
@@ -398,7 +398,7 @@ insert_sd_node(struct wim_sd_set *set, struct sd_node *new)
 
 /* Returns the index of the security descriptor having a SHA1 message digest of
  * @hash.  If not found, return -1. */
-int
+static int
 lookup_sd(struct wim_sd_set *set, const u8 hash[SHA1_HASH_SIZE])
 {
        struct rb_node *node = set->rb_root.rb_node;