@pmatilai commented on this pull request.


> -         bn[strlen(bn)-strlen(".attr")] = '\0';
-           fc->atypes[i] = rpmfcAttrNew(bn);
+       nfiles = argvCount(files);
+    }
+    char * local_attr_names = rpmExpand("%{?__local_file_attrs}", NULL);
+    ARGV_t local_attrs = argvSplitString(local_attr_names, ":", 
ARGV_SKIPEMPTY);
+    nlocals = argvCount(local_attrs);
+    fc->atypes = xcalloc(nfiles + nlocals + 1, sizeof(*fc->atypes));
+
+    for (int i = 0; i < nfiles; i++) {
+       char *bn = basename(files[i]);
+       bn[strlen(bn)-strlen(".attr")] = '\0';
+       // skip file attrs found in __local_file_attrs for now
+       for (j=0; (j < nlocals) && strcmp(bn, local_attrs[j]); j++);
+       if (j < nlocals) {
+           free(bn);

This is not right, basename() doesn't allocate, so this would free some random 
pointer inside the one that is.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/2734#pullrequestreview-1864947811
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/2734/review/1864947...@github.com>
_______________________________________________
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint

Reply via email to