X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=parsekey.c;h=f9b1465b78dece1a18c2cde309cfb937d69bcab6;hp=008248e005633f0563d9bdcd409c61130cfc1423;hb=7fd2267eca87bd9bcfe5e66e95e2e683bda1533b;hpb=5d859953e393a2539e67df3ce73798e7029cf5b9 diff --git a/parsekey.c b/parsekey.c index 008248e..f9b1465 100644 --- a/parsekey.c +++ b/parsekey.c @@ -354,6 +354,12 @@ onak_status_t read_openpgp_stream(int (*getchar_func)(void *ctx, size_t count, } else { rc = ONAK_E_INVALID_PKT; } + if (rc == ONAK_E_OK) { + /* Make sure the packet version is sane */ + if (curpacket->packet->data[0] > 4) { + rc = ONAK_E_INVALID_PKT; + } + } } if (packetend != NULL) {