Corrected code status error from previous wrong CVS comits

This commit is contained in:
Karl-Heinz Zimmer 2001-12-06 16:59:09 +00:00
parent 8cd3d96f2d
commit 08debc7ab2

View File

@ -845,10 +845,12 @@ bool checkMessageSignature( const char* ciphertext,
/* Provide information in the sigmeta struct */ /* Provide information in the sigmeta struct */
/* the status string */ /* the status string */
statusStr = sig_status_to_string( status ); statusStr = sig_status_to_string( status );
// PENDING(kalle) Handle out of memory
sigmeta->status = malloc( strlen( statusStr ) + 1 ); sigmeta->status = malloc( strlen( statusStr ) + 1 );
if( sigmeta->status ) {
strcpy( sigmeta->status, statusStr ); strcpy( sigmeta->status, statusStr );
sigmeta->status[strlen( statusStr )] = '\0'; sigmeta->status[strlen( statusStr )] = '\0';
} else
; // nothing to do, is already 0
// Extended information for any number of signatures. // Extended information for any number of signatures.
fpr = gpgme_get_sig_status( ctx, sig_idx, &status, &created ); fpr = gpgme_get_sig_status( ctx, sig_idx, &status, &created );
@ -857,27 +859,35 @@ bool checkMessageSignature( const char* ciphertext,
struct tm* ctime_val; struct tm* ctime_val;
const char* sig_status; const char* sig_status;
// PENDING(kalle) Handle out of memory void* realloc_return = realloc( sigmeta->extended_info,
sigmeta->extended_info = realloc( sigmeta->extended_info,
sizeof( struct SignatureMetaDataExtendedInfo ) * ( sig_idx + 1 ) ); sizeof( struct SignatureMetaDataExtendedInfo ) * ( sig_idx + 1 ) );
if( realloc_return ) {
sigmeta->extended_info = realloc_return;
// the creation time // the creation time
// PENDING(kalle) Handle out of memory
sigmeta->extended_info[sig_idx].creation_time = malloc( sizeof( struct tm ) ); sigmeta->extended_info[sig_idx].creation_time = malloc( sizeof( struct tm ) );
if( sigmeta->extended_info[sig_idx].creation_time ) {
ctime_val = localtime( &created ); ctime_val = localtime( &created );
memcpy( sigmeta->extended_info[sig_idx].creation_time, memcpy( sigmeta->extended_info[sig_idx].creation_time,
ctime_val, sizeof( struct tm ) ); ctime_val, sizeof( struct tm ) );
}
err = gpgme_get_sig_key (ctx, sig_idx, &key); err = gpgme_get_sig_key (ctx, sig_idx, &key);
sig_status = sig_status_to_string( status ); sig_status = sig_status_to_string( status );
// PENDING(kalle) Handle out of memory
sigmeta->extended_info[sig_idx].status_text = malloc( strlen( sig_status ) + 1 ); sigmeta->extended_info[sig_idx].status_text = malloc( strlen( sig_status ) + 1 );
if( sigmeta->extended_info[sig_idx].status_text ) {
strcpy( sigmeta->extended_info[sig_idx].status_text, strcpy( sigmeta->extended_info[sig_idx].status_text,
sig_status ); sig_status );
sigmeta->extended_info[sig_idx].status_text[strlen( sig_status )] = '\0'; sigmeta->extended_info[sig_idx].status_text[strlen( sig_status )] = '\0';
// PENDING(kalle) Handle out of memory }
sigmeta->extended_info[sig_idx].fingerprint = malloc( strlen( fpr ) + 1 ); sigmeta->extended_info[sig_idx].fingerprint = malloc( strlen( fpr ) + 1 );
if( sigmeta->extended_info[sig_idx].fingerprint ) {
strcpy( sigmeta->extended_info[sig_idx].fingerprint, fpr ); strcpy( sigmeta->extended_info[sig_idx].fingerprint, fpr );
sigmeta->extended_info[sig_idx].fingerprint[strlen( fpr )] = '\0'; sigmeta->extended_info[sig_idx].fingerprint[strlen( fpr )] = '\0';
}
} else
break; // if allocation fails once, it isn't likely to
// succeed the next time either
fpr = gpgme_get_sig_status (ctx, ++sig_idx, &status, &created); fpr = gpgme_get_sig_status (ctx, ++sig_idx, &status, &created);
} }