Fix an incoherent test.
Pointer 'o' is set inside a local buffer, so it can't be NULL.
Also fix coding style and add comments
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4754)
(cherry picked from commit cef115ff0ca4255d3decc1dda87c5418a961fd2c)
FdaSilvaYY authored 6 years ago
Rich Salz committed 6 years ago
724 | 724 | return (p); |
725 | 725 | } |
726 | 726 | |
727 | /* | |
728 | * Parse a BIO sink to create some extra oid's objects. | |
729 | * Line format:<OID:isdigit or '.']><isspace><SN><isspace><LN> | |
730 | */ | |
727 | 731 | int OBJ_create_objects(BIO *in) |
728 | 732 | { |
729 | 733 | MS_STATIC char buf[512]; |
745 | 749 | *(s++) = '\0'; |
746 | 750 | while (isspace((unsigned char)*s)) |
747 | 751 | s++; |
748 | if (*s == '\0') | |
752 | if (*s == '\0') { | |
749 | 753 | s = NULL; |
750 | else { | |
754 | } else { | |
751 | 755 | l = s; |
752 | 756 | while ((*l != '\0') && !isspace((unsigned char)*l)) |
753 | 757 | l++; |
755 | 759 | *(l++) = '\0'; |
756 | 760 | while (isspace((unsigned char)*l)) |
757 | 761 | l++; |
758 | if (*l == '\0') | |
762 | if (*l == '\0') { | |
759 | 763 | l = NULL; |
760 | } else | |
764 | } | |
765 | } else { | |
761 | 766 | l = NULL; |
767 | } | |
762 | 768 | } |
763 | } else | |
769 | } else { | |
764 | 770 | s = NULL; |
765 | if ((o == NULL) || (*o == '\0')) | |
766 | return (num); | |
771 | } | |
772 | if (*o == '\0') | |
773 | return num; | |
767 | 774 | if (!OBJ_create(o, s, l)) |
768 | 775 | return (num); |
769 | 776 | num++; |