projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
X509V3_add_i2d() needs to be able to allocate a
[openssl.git]
/
crypto
/
x509v3
/
v3_lib.c
diff --git
a/crypto/x509v3/v3_lib.c
b/crypto/x509v3/v3_lib.c
index 844cee1c140ce8e69ac1c72137508f4e593f7ad2..d8301a67bd2f6a1f84f06da49051d48de779ee59 100644
(file)
--- a/
crypto/x509v3/v3_lib.c
+++ b/
crypto/x509v3/v3_lib.c
@@
-228,7
+228,7
@@
void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit, int *idx)
* 'value' arguments (if relevant) are the extensions internal structure.
*/
* 'value' arguments (if relevant) are the extensions internal structure.
*/
-int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
+int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *
*
x, int nid, void *value,
int crit, unsigned long flags)
{
int extidx = -1;
int crit, unsigned long flags)
{
int extidx = -1;
@@
-240,7
+240,7
@@
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
* look for existing extension.
*/
if(ext_op != X509V3_ADD_APPEND)
* look for existing extension.
*/
if(ext_op != X509V3_ADD_APPEND)
- extidx = X509v3_get_ext_by_NID(x, nid, -1);
+ extidx = X509v3_get_ext_by_NID(
*
x, nid, -1);
/* See if extension exists */
if(extidx >= 0) {
/* See if extension exists */
if(extidx >= 0) {
@@
-254,7
+254,7
@@
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
}
/* If delete, just delete it */
if(ext_op == X509V3_ADD_DELETE) {
}
/* If delete, just delete it */
if(ext_op == X509V3_ADD_DELETE) {
- if(!sk_X509_EXTENSION_delete(x, extidx)) return -1;
+ if(!sk_X509_EXTENSION_delete(
*
x, extidx)) return -1;
return 1;
}
} else {
return 1;
}
} else {
@@
-281,13
+281,14
@@
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) *x, int nid, void *value,
/* If extension exists replace it.. */
if(extidx >= 0) {
/* If extension exists replace it.. */
if(extidx >= 0) {
- extmp = sk_X509_EXTENSION_value(x, extidx);
+ extmp = sk_X509_EXTENSION_value(
*
x, extidx);
X509_EXTENSION_free(extmp);
X509_EXTENSION_free(extmp);
- if(!sk_X509_EXTENSION_set(x, extidx, ext)) return -1;
+ if(!sk_X509_EXTENSION_set(
*
x, extidx, ext)) return -1;
return 1;
}
return 1;
}
- if(!sk_X509_EXTENSION_push(x, ext)) return -1;
+ if(!*x && !(*x = sk_X509_EXTENSION_new_null())) return -1;
+ if(!sk_X509_EXTENSION_push(*x, ext)) return -1;
return 1;
return 1;