diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2016-11-22 08:49:35 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2016-11-22 10:19:24 +0200 |
commit | a6fca1415db8cc69828d4d0373157d23180cd1cb (patch) | |
tree | 7c1a37c858f56d427192becec6c3736e36899489 /lib/header.c | |
parent | fa5ca17382303b764c91163ead81ab95d411958e (diff) | |
download | rpm-a6fca1415db8cc69828d4d0373157d23180cd1cb.tar.gz |
Refactor headerVerifyInfo() to hdrblob struct, adjust callers
Since the blob knows whether it has an immutable region or not, callers
no longer need to care about such details.
Diffstat (limited to 'lib/header.c')
-rw-r--r-- | lib/header.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/header.c b/lib/header.c index e61524fd1..b8c1bffec 100644 --- a/lib/header.c +++ b/lib/header.c @@ -206,14 +206,14 @@ Header headerNew(void) return headerCreate(NULL, 0, 0); } -int headerVerifyInfo(int il, int dl, - const struct entryInfo_s * pe, const void *dataStart, - char **emsg) +int headerVerifyInfo(hdrblob blob, char **emsg) { struct entryInfo_s info; int i, len = 0; int32_t end = 0; - const char *ds = dataStart; + const char *ds = (const char *) blob->dataStart; + int32_t il = (blob->regionTag) ? blob->il-1 : blob->il; + entryInfo pe = (blob->regionTag) ? blob->pe+1 : blob->pe; for (i = 0; i < il; i++) { ei2h(&pe[i], &info); @@ -226,14 +226,14 @@ int headerVerifyInfo(int il, int dl, goto err; if (hdrchkAlign(info.type, info.offset)) goto err; - if (hdrchkRange(dl, info.offset)) + if (hdrchkRange(blob->dl, info.offset)) goto err; /* Verify the data actually fits */ len = dataLength(info.type, ds + info.offset, - info.count, 1, ds + dl); + info.count, 1, ds + blob->dl); end = info.offset + len; - if (hdrchkRange(dl, end) || len <= 0) + if (hdrchkRange(blob->dl, end) || len <= 0) goto err; } return 0; /* Everything ok */ |