RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 15-Apr-2016 20:26:17 Branch: rpm-5_4 Handle: 2016041518261700 Modified files: (Branch: rpm-5_4) rpm/rpmdb header_internal.c Log: - header: verify signature tag type failures as early as possible. Summary: Revision Changes Path 1.20.2.6 +16 -13 rpm/rpmdb/header_internal.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmdb/header_internal.c ============================================================================ $ cvs diff -u -r1.20.2.5 -r1.20.2.6 header_internal.c --- rpm/rpmdb/header_internal.c 11 Apr 2016 22:02:11 -0000 1.20.2.5 +++ rpm/rpmdb/header_internal.c 15 Apr 2016 18:26:17 -0000 1.20.2.6 @@ -49,21 +49,24 @@ if (info->tag == 1029 && info->type == 1) info->type = RPM_UINT8_TYPE; - /* XXX Ensure that pubkey type is sane, fail early if not.. */ - if (info->tag == RPMTAG_PUBKEYS - && info->type != RPM_STRING_ARRAY_TYPE) - { - return (int)i; + /* XXX Ensure that sigh tags have usual types, fail early if not. */ + switch (info->tag) { + case RPMSIGTAG_SHA1: + if (info->type != RPM_STRING_TYPE) return (int)i; + break; + case RPMTAG_PUBKEYS: + if (info->type != RPM_STRING_ARRAY_TYPE) return (int)i; + break; + case RPMSIGTAG_DSA: + case RPMSIGTAG_RSA: + case RPMSIGTAG_ECDSA: + case RPMSIGTAG_PADDING: + if (info->type != RPM_BIN_TYPE) return (int)i; + break; + default: + break; } -#ifdef NOTYET /* XXX more todo here */ -#if !defined(SUPPORT_I18NSTRING_TYPE) - /* XXX Re-map RPM_I18NSTRING_TYPE -> RPM_STRING_TYPE */ - if (info->type == RPM_I18NSTRING_TYPE) - info->type = RPM_STRING_TYPE; -#endif -#endif - if (!(negate || info->offset >= 0)) return (int)i; if (negate) @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org