Fix bug in x509_get_{ecpubkey,subpubkey}()

- 'p' was not properly updated
- also add a few more checks while at it
1 file changed