Make sure PKCS7_get_octet_string() return values are checked for NULL.
Reported by David Ramos (and simultaneously to OpenSSL as PR#3339).

ok beck@ logan@
Remove broken-by-design test
Assorted cleanups:
- replace hardcoded sizes with sizeof()
- pqueue_find() apparently used to need to keep track of the previous node
  when iterating, which causes its logic to be complicated. However, nowadays
  it only needs to iterate, so replace with a straightforward, much
  readable logic.
- remove #if 0'ed code

From ``sin'' from 2f30 dot org on tech@, thanks!