diff options
| author | Federico G. Schwindt <fgsch@lodoss.net> | 2013-08-26 12:18:46 +0100 |
|---|---|---|
| committer | Federico G. Schwindt <fgsch@lodoss.net> | 2013-08-26 12:18:46 +0100 |
| commit | 3b65f4e38d1ab019513f16b70581ae10574006e8 (patch) | |
| tree | 9d7cd8b517acd1a08f32615ea3c7d1103171c6d0 /src | |
| parent | 6ac5a82eecb76ec35f3f484149ad668073a52620 (diff) | |
| download | ngircd-3b65f4e38d1ab019513f16b70581ae10574006e8.tar.gz ngircd-3b65f4e38d1ab019513f16b70581ae10574006e8.zip | |
Change strdup() to strndup()
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/client.c | 3 | ||||
| -rw-r--r-- | src/ngircd/conn-ssl.c | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c index 1c710344..72774ca9 100644 --- a/src/ngircd/client.c +++ b/src/ngircd/client.c @@ -469,7 +469,8 @@ Client_SetAccountName(CLIENT *Client, const char *AccountName) free(Client->account_name); if (*AccountName) - Client->account_name = strdup(AccountName); + Client->account_name = strndup(AccountName, + CLIENT_NICK_LEN - 1); else Client->account_name = NULL; } diff --git a/src/ngircd/conn-ssl.c b/src/ngircd/conn-ssl.c index 4156fb19..096ff951 100644 --- a/src/ngircd/conn-ssl.c +++ b/src/ngircd/conn-ssl.c @@ -61,7 +61,7 @@ static gnutls_dh_params_t dh_params; static bool ConnSSL_LoadServerKey_gnutls PARAMS(( void )); #endif -#define CERTFP_LEN (20 * 2 + 1) +#define SHA1_STRING_LEN (20 * 2 + 1) static bool ConnSSL_Init_SSL PARAMS(( CONNECTION *c )); static int ConnectAccept PARAMS(( CONNECTION *c, bool connect )); @@ -723,7 +723,7 @@ ConnSSL_InitCertFp( CONNECTION *c ) assert(c->ssl_state.fingerprint == NULL); - c->ssl_state.fingerprint = malloc(CERTFP_LEN); + c->ssl_state.fingerprint = malloc(SHA1_STRING_LEN); if (!c->ssl_state.fingerprint) return 0; @@ -858,7 +858,7 @@ bool ConnSSL_SetCertFp(CONNECTION *c, const char *fingerprint) { assert (c != NULL); - c->ssl_state.fingerprint = strdup(fingerprint); + c->ssl_state.fingerprint = strndup(fingerprint, SHA1_STRING_LEN - 1); return c->ssl_state.fingerprint != NULL; } #else |