fix: --checksig segfault with odd pgp output (e.g. w/o ~/.pgp) (#3720)

CVS patchset: 3110
CVS date: 1999/06/25 10:14:13
This commit is contained in:
jbj 1999-06-25 10:14:13 +00:00
parent 7f5a4a4aed
commit de9f040664
4 changed files with 30 additions and 30 deletions

View File

@ -17,7 +17,8 @@
- MiNT port (Guido Flohr <gufl0000@stud.uni-sb.de>). - MiNT port (Guido Flohr <gufl0000@stud.uni-sb.de>).
- fix: --rebuilddb with --root dinna remove directory (Michael Andres). - fix: --rebuilddb with --root dinna remove directory (Michael Andres).
- fix: false fingerprint stat cache hit -- "the tetex problem" (#2727). - fix: false fingerprint stat cache hit -- "the tetex problem" (#2727).
- fix: bsearch needs macro table sorted after undefine. - fix: bsearch needs macro table sorted after undefine. (#3713).
- fix: --checksig segfault with odd pgp output (e.g. w/o ~/.pgp) (#3720)
3.0 -> 3.0.1 3.0 -> 3.0.1
- fix: %verifyscript resurrected (Shing-Gene Yung). - fix: %verifyscript resurrected (Shing-Gene Yung).

View File

@ -153,7 +153,6 @@ int doCheckSig(int flags, const char **argv)
unsigned char buffer[8192]; unsigned char buffer[8192];
unsigned char missingKeys[7164]; unsigned char missingKeys[7164];
unsigned char untrustedKeys[7164]; unsigned char untrustedKeys[7164];
char *tempKey;
Header sig; Header sig;
HeaderIterator sigIter; HeaderIterator sigIter;
int_32 tag, type, count; int_32 tag, type, count;
@ -210,15 +209,12 @@ int doCheckSig(int flags, const char **argv)
fdClose(fd); fdClose(fd);
fdClose(ofd); fdClose(ofd);
sigIter = headerInitIterator(sig);
res2 = 0; res2 = 0;
missingKeys[0] = '\0'; missingKeys[0] = '\0';
untrustedKeys[0] = '\0'; untrustedKeys[0] = '\0';
if (rpmIsVerbose()) { sprintf(buffer, "%s:%c", rpm, (rpmIsVerbose() ? '\n' : ' ') );
sprintf(buffer, "%s:\n", rpm);
} else { sigIter = headerInitIterator(sig);
sprintf(buffer, "%s: ", rpm);
}
while (headerNextIterator(sigIter, &tag, &type, &ptr, &count)) { while (headerNextIterator(sigIter, &tag, &type, &ptr, &count)) {
if ((tag == RPMSIGTAG_PGP || tag == RPMSIGTAG_PGP5) if ((tag == RPMSIGTAG_PGP || tag == RPMSIGTAG_PGP5)
&& !(flags & CHECKSIG_PGP)) && !(flags & CHECKSIG_PGP))
@ -237,6 +233,7 @@ int doCheckSig(int flags, const char **argv)
strcat(buffer, result); strcat(buffer, result);
res2 = 1; res2 = 1;
} else { } else {
char *tempKey;
switch (tag) { switch (tag) {
case RPMSIGTAG_SIZE: case RPMSIGTAG_SIZE:
strcat(buffer, "SIZE "); strcat(buffer, "SIZE ");
@ -255,17 +252,18 @@ int doCheckSig(int flags, const char **argv)
int offset = 7; int offset = 7;
strcat(buffer, "(PGP) "); strcat(buffer, "(PGP) ");
tempKey = strstr(result, "Key ID"); tempKey = strstr(result, "Key ID");
if (!tempKey) if (tempKey == NULL) {
{
tempKey = strstr(result, "keyid:"); tempKey = strstr(result, "keyid:");
offset = 9; offset = 9;
} }
if (res3 == RPMSIG_NOKEY) { if (tempKey) {
if (res3 == RPMSIG_NOKEY) {
strcat(missingKeys, " PGP#"); strcat(missingKeys, " PGP#");
strncat(missingKeys, tempKey + offset, 8); strncat(missingKeys, tempKey + offset, 8);
} else { } else {
strcat(untrustedKeys, " PGP#"); strcat(untrustedKeys, " PGP#");
strncat(untrustedKeys, tempKey + offset, 8); strncat(untrustedKeys, tempKey + offset, 8);
}
} }
} else { } else {
strcat(buffer, "PGP "); strcat(buffer, "PGP ");
@ -278,7 +276,8 @@ int doCheckSig(int flags, const char **argv)
strcat(buffer, "(GPG) "); strcat(buffer, "(GPG) ");
strcat(missingKeys, " GPG#"); strcat(missingKeys, " GPG#");
tempKey = strstr(result, "key ID"); tempKey = strstr(result, "key ID");
strncat(missingKeys, tempKey+7, 8); if (tempKey)
strncat(missingKeys, tempKey+7, 8);
} else { } else {
strcat(buffer, "GPG "); strcat(buffer, "GPG ");
res2 = 1; res2 = 1;

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 1999-06-24 17:12-0400\n" "POT-Creation-Date: 1999-06-25 06:03-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -121,12 +121,12 @@ msgstr ""
msgid "lookup I18N strings in specfile catalog" msgid "lookup I18N strings in specfile catalog"
msgstr "" msgstr ""
#: ../checksig.c:27 ../checksig.c:166 #: ../checksig.c:27 ../checksig.c:165
#, c-format #, c-format
msgid "%s: Open failed\n" msgid "%s: Open failed\n"
msgstr "" msgstr ""
#: ../checksig.c:31 ../checksig.c:171 #: ../checksig.c:31 ../checksig.c:170
#, c-format #, c-format
msgid "%s: readLead failed\n" msgid "%s: readLead failed\n"
msgstr "" msgstr ""
@ -141,12 +141,12 @@ msgstr ""
msgid "%s: Can't re-sign v2.0 RPM\n" msgid "%s: Can't re-sign v2.0 RPM\n"
msgstr "" msgstr ""
#: ../checksig.c:43 ../checksig.c:181 #: ../checksig.c:43 ../checksig.c:180
#, c-format #, c-format
msgid "%s: rpmReadSignature failed\n" msgid "%s: rpmReadSignature failed\n"
msgstr "" msgstr ""
#: ../checksig.c:56 ../checksig.c:195 #: ../checksig.c:56 ../checksig.c:194
msgid "Couldn't read the header/archive" msgid "Couldn't read the header/archive"
msgstr "" msgstr ""
@ -167,42 +167,42 @@ msgstr ""
msgid "Couldn't write package" msgid "Couldn't write package"
msgstr "" msgstr ""
#: ../checksig.c:176 #: ../checksig.c:175
#, c-format #, c-format
msgid "%s: No signature available (v1.0 RPM)\n" msgid "%s: No signature available (v1.0 RPM)\n"
msgstr "" msgstr ""
#: ../checksig.c:186 #: ../checksig.c:185
#, c-format #, c-format
msgid "%s: No signature available\n" msgid "%s: No signature available\n"
msgstr "" msgstr ""
#: ../checksig.c:202 #: ../checksig.c:201
#, c-format #, c-format
msgid "Unable to write %s" msgid "Unable to write %s"
msgstr "" msgstr ""
#: ../checksig.c:328 #: ../checksig.c:327
msgid "NOT OK" msgid "NOT OK"
msgstr "" msgstr ""
#: ../checksig.c:329 ../checksig.c:343 #: ../checksig.c:328 ../checksig.c:342
msgid " (MISSING KEYS:" msgid " (MISSING KEYS:"
msgstr "" msgstr ""
#: ../checksig.c:331 ../checksig.c:345 #: ../checksig.c:330 ../checksig.c:344
msgid ") " msgid ") "
msgstr "" msgstr ""
#: ../checksig.c:332 ../checksig.c:346 #: ../checksig.c:331 ../checksig.c:345
msgid " (UNTRUSTED KEYS:" msgid " (UNTRUSTED KEYS:"
msgstr "" msgstr ""
#: ../checksig.c:334 ../checksig.c:348 #: ../checksig.c:333 ../checksig.c:347
msgid ")" msgid ")"
msgstr "" msgstr ""
#: ../checksig.c:342 #: ../checksig.c:341
msgid "OK" msgid "OK"
msgstr "" msgstr ""
@ -2595,12 +2595,12 @@ msgstr ""
msgid "Target buffer overflow" msgid "Target buffer overflow"
msgstr "" msgstr ""
#: ../lib/macro.c:1274 ../lib/macro.c:1282 #: ../lib/macro.c:1278 ../lib/macro.c:1286
#, c-format #, c-format
msgid "File %s: %s" msgid "File %s: %s"
msgstr "" msgstr ""
#: ../lib/macro.c:1285 #: ../lib/macro.c:1289
#, c-format #, c-format
msgid "File %s is smaller than %d bytes" msgid "File %s is smaller than %d bytes"
msgstr "" msgstr ""

View File

@ -2,7 +2,7 @@ Summary: The Red Hat package management system.
Name: rpm Name: rpm
%define version 3.0.2 %define version 3.0.2
Version: %{version} Version: %{version}
Release: 0.8 Release: 0.9
Group: System Environment/Base Group: System Environment/Base
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-3.0.x/rpm-%{version}.tar.gz Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-3.0.x/rpm-%{version}.tar.gz
Copyright: GPL Copyright: GPL