summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2016-11-17 14:02:09 +0200
committerPanu Matilainen <pmatilai@redhat.com>2016-11-17 14:02:09 +0200
commit439c8bc0488d83bfbd64aee5bb5f6b02394efd34 (patch)
treede07d5de29aaab337ee560b9c33c3789933d9835
parent7db844b2538227e4e5ceaa6bbf3b4e6713c8c8ce (diff)
downloadrpm-439c8bc0488d83bfbd64aee5bb5f6b02394efd34.tar.gz
Optionally calculate string length in rpmSigInfoParse()
Not used yet, but doing this here centrally, after validating the type otherwise etc makes sense.
-rw-r--r--lib/signature.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/signature.c b/lib/signature.c
index c7ae0d611..67f649c54 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -74,18 +74,21 @@ rpmRC rpmSigInfoParse(rpmtd td, const char *origin,
break;
}
- if (tagsize && (td->flags & RPMTD_IMMUTABLE) && tagsize != td->size) {
- rasprintf(msg, _("%s tag %u: BAD, invalid size %u"),
- origin, td->tag, td->size);
- goto exit;
- }
-
if (tagtype && tagtype != td->type) {
rasprintf(msg, _("%s tag %u: BAD, invalid type %u"),
origin, td->tag, td->type);
goto exit;
}
+ if (td->type == RPM_STRING_TYPE && td->size == 0)
+ td->size = strlen(td->data) + 1;
+
+ if (tagsize && (td->flags & RPMTD_IMMUTABLE) && tagsize != td->size) {
+ rasprintf(msg, _("%s tag %u: BAD, invalid size %u"),
+ origin, td->tag, td->size);
+ goto exit;
+ }
+
if (sinfo->type == RPMSIG_SIGNATURE_TYPE) {
if (pgpPrtParams(td->data, td->count, PGPTAG_SIGNATURE, &sig)) {
rasprintf(msg, _("%s tag %u: BAD, invalid OpenPGP signature"),