Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if rpmtdGetUint32 return NULL, return RPMRC_FAIL #1638

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/rpmtriggers.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
if (matchFunc(ts, te, pfx, sense)) {
for (i = 0; i < rpmdbIndexIteratorNumPkgs(ii); i++) {
struct rpmtd_s priorities;
unsigned int priority;
unsigned int *priority;
unsigned int offset = rpmdbIndexIteratorPkgOffset(ii, i);
unsigned int tix = rpmdbIndexIteratorTagNum(ii, i);

Expand All @@ -535,11 +535,17 @@ rpmRC runFileTriggers(rpmts ts, rpmte te, rpmsenseFlags sense,
trigH = rpmdbGetHeaderAt(rpmtsGetRdb(ts), offset);
headerGet(trigH, priorityTag, &priorities, HEADERGET_MINMEM);
rpmtdSetIndex(&priorities, tix);
priority = *rpmtdGetUint32(&priorities);
priority = rpmtdGetUint32(&priorities);
headerFree(trigH);

/* Store file trigger in array */
rpmtriggersAdd(triggers, offset, tix, priority);
if (priority == NULL) {
fprintf(stderr, "DB may be destroyed, some filetriggers will not run. Please reinstall the packages");
return RPMRC_FAIL;
} else {
/* Store file trigger in array */
rpmtriggersAdd(triggers, offset, tix, *priority);
}

}
}
free(pfx);
Expand Down