Fix some warnings

This commit is contained in:
Matt Johnston 2013-11-25 23:08:33 +08:00
parent 5a85c4b91b
commit c5e36f8e3c
5 changed files with 11 additions and 9 deletions

View File

@ -201,7 +201,7 @@ static void agent_get_key_list(m_list * ret_list)
num = buf_getint(inbuf); num = buf_getint(inbuf);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
sign_key * pubkey = NULL; sign_key * pubkey = NULL;
int key_type = DROPBEAR_SIGNKEY_ANY; enum signkey_type key_type = DROPBEAR_SIGNKEY_ANY;
buffer * key_buf; buffer * key_buf;
/* each public key is encoded as a string */ /* each public key is encoded as a string */

View File

@ -21,7 +21,7 @@ AC_SUBST(LD)
if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC) AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
CFLAGS="-Os -W -Wall" CFLAGS="-Os -W -Wall -Wno-pointer-sign"
fi fi
# large file support is useful for scp # large file support is useful for scp

View File

@ -881,14 +881,17 @@ void disallow_core() {
/* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */ /* Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE, with the result in *val */
int m_str_to_uint(const char* str, unsigned int *val) { int m_str_to_uint(const char* str, unsigned int *val) {
unsigned long l;
errno = 0; errno = 0;
*val = strtoul(str, NULL, 10); l = strtoul(str, NULL, 10);
/* The c99 spec doesn't actually seem to define EINVAL, but most platforms /* The c99 spec doesn't actually seem to define EINVAL, but most platforms
* I've looked at mention it in their manpage */ * I've looked at mention it in their manpage */
if ((*val == 0 && errno == EINVAL) if ((l == 0 && errno == EINVAL)
|| (*val == ULONG_MAX && errno == ERANGE)) { || (l == ULONG_MAX && errno == ERANGE)
|| (l > UINT_MAX)) {
return DROPBEAR_FAILURE; return DROPBEAR_FAILURE;
} else { } else {
*val = l;
return DROPBEAR_SUCCESS; return DROPBEAR_SUCCESS;
} }
} }

4
ecc.c
View File

@ -75,8 +75,8 @@ struct dropbear_ecc_curve* curve_for_dp(const ltc_ecc_set_type *dp) {
ecc_key * new_ecc_key(void) { ecc_key * new_ecc_key(void) {
ecc_key *key = m_malloc(sizeof(*key)); ecc_key *key = m_malloc(sizeof(*key));
m_mp_alloc_init_multi(&key->pubkey.x, &key->pubkey.y, m_mp_alloc_init_multi((mp_int**)&key->pubkey.x, (mp_int**)&key->pubkey.y,
&key->pubkey.z, &key->k, NULL); (mp_int**)&key->pubkey.z, (mp_int**)&key->k, NULL);
return key; return key;
} }

View File

@ -508,14 +508,13 @@ void buf_put_sign(buffer* buf, sign_key *key, enum signkey_type type,
* signature blob */ * signature blob */
int buf_verify(buffer * buf, sign_key *key, buffer *data_buf) { int buf_verify(buffer * buf, sign_key *key, buffer *data_buf) {
unsigned int bloblen;
unsigned char * type_name = NULL; unsigned char * type_name = NULL;
unsigned int type_name_len = 0; unsigned int type_name_len = 0;
enum signkey_type type; enum signkey_type type;
TRACE(("enter buf_verify")) TRACE(("enter buf_verify"))
bloblen = buf_getint(buf); buf_getint(buf); /* blob length */
type_name = buf_getstring(buf, &type_name_len); type_name = buf_getstring(buf, &type_name_len);
type = signkey_type_from_name(type_name, type_name_len); type = signkey_type_from_name(type_name, type_name_len);
m_free(type_name); m_free(type_name);