comment utiliser sizeof( )
Bonjour,
mon programme fait un segmentation fault quand il execute l'instruction suivante :
memset(policy, 0, sizeof(srtp_policy_t));
Voici le message de seg fault :
Code:
1 2 3 4
| Program received signal SIGSEGV, Segmentation fault.
memset () at ../sysdeps/x86_64/memset.S:331
331 ../sysdeps/x86_64/memset.S: Aucun fichier ou dossier de ce type.
in ../sysdeps/x86_64/memset.S |
Voici le contexte:
Code:
1 2 3 4 5 6
| srtp_policy_t *policy;
policy = si->u.rtp.info->policy;
memset(policy, 0, sizeof(srtp_policy_t));
if(computeSessKey(si, policy, key_len) == -1)
return -1; |
et voici srtp_policy_t :
Code:
1 2 3 4 5 6 7 8 9 10 11 12
| typedef struct srtp_policy_t {
ssrc_t ssrc; /**< The SSRC value of stream, or the
* flags SSRC_ANY_INBOUND or
* SSRC_ANY_OUTBOUND if key sharing
* is used for this policy element.
*/
crypto_policy_t rtp; /**< SRTP crypto policy. */
crypto_policy_t rtcp; /**< SRTCP crypto policy. */
unsigned char *key; /**< Pointer to the SRTP master key for
* this stream. */
struct srtp_policy_t *next; /**< Pointer to next stream policy. */
} srtp_policy_t; |
Apparemment c'est sizeof(srtp_policy_t qu'il n'aime pas ...
Comment je devrais indiquer à memset qu'il faut prendre la taille de srtp_policy_t ?
Merci d'avance pour votre aide.