зеркало из https://github.com/mozilla/pjs.git
Bug: 348366
Description: ber_printf support for O format Fix Description: When calling ber_printf with the 'O' format, the corresponding argument must be a struct berval *. If the bval argument is NULL, nothing is written (i.e. it is safe to use a NULL here). Otherwise, bval->bv_len bytes from bval->bv_val will be written to the output.
This commit is contained in:
Родитель
f4a6bf3d6b
Коммит
7654c90cd7
|
@ -574,7 +574,7 @@ ber_printf( BerElement *ber, const char *fmt, ... )
|
|||
{
|
||||
va_list ap;
|
||||
char *s, **ss;
|
||||
struct berval **bv;
|
||||
struct berval *bval, **bv;
|
||||
int rc, i;
|
||||
ber_len_t len;
|
||||
|
||||
|
@ -615,6 +615,17 @@ ber_printf( BerElement *ber, const char *fmt, ... )
|
|||
rc = ber_put_ostring( ber, s, len, ber->ber_tag );
|
||||
break;
|
||||
|
||||
case 'O': /* berval octet string */
|
||||
if( ( bval = va_arg( ap, struct berval * ) ) == NULL )
|
||||
break;
|
||||
if( bval->bv_len == 0 ) {
|
||||
rc = ber_put_ostring( ber, "", 0, ber->ber_tag );
|
||||
} else {
|
||||
rc = ber_put_ostring( ber, bval->bv_val, bval->bv_len,
|
||||
ber->ber_tag );
|
||||
}
|
||||
break;
|
||||
|
||||
case 's': /* string */
|
||||
s = va_arg( ap, char * );
|
||||
rc = ber_put_string( ber, s, ber->ber_tag );
|
||||
|
|
Загрузка…
Ссылка в новой задаче