Commit 17597e19 authored by Pekka Pessi's avatar Pekka Pessi

msg module: using size_t. Checking for input value for offsets.

darcs-hash:20060912115448-65a35-f1f49ed67c7057aa266a2b0d48788b0035530728.gz
parent 4642c395
......@@ -61,9 +61,8 @@
*
* @return Number of characters scanned, or zero upon an error.
*/
static int msg_auth_item_scan(char *start)
static size_t msg_auth_item_scan(char *start)
{
int tlen;
char *p, *s;
p = s = start;
......
......@@ -199,7 +199,7 @@ char *msg_unknown_dup_one(msg_header_t *dst, msg_header_t const *src,
* msg_common_t pl_common[1]; // Common fragment info
* msg_header_t *pl_next; // Next payload object
* char *pl_data; // Data - may contain zero bytes
* unsigned pl_len; // Length of message payload
* usize_t pl_len; // Length of message payload
* } msg_payload_t;
* @endcode
*/
......@@ -277,7 +277,7 @@ char *msg_payload_dup_one(msg_header_t *dst,
return b + pl->pl_len + 1;
}
int msg_payload_length(msg_payload_t const *pl)
usize_t msg_payload_length(msg_payload_t const *pl)
{
/* XXX */
return 0;
......
......@@ -192,7 +192,7 @@ int msg_list_append_items(su_home_t *home,
msg_list_t *k,
msg_param_t const items[])
{
int i;
size_t i;
if (k == NULL) return -1;
if (items == NULL) return 0;
......@@ -216,7 +216,7 @@ int msg_list_append_items(su_home_t *home,
int msg_list_replace_items(su_home_t *home, msg_list_t *k,
msg_param_t const items[])
{
int i;
size_t i;
if (k == NULL) return -1;
if (items == NULL) return 0;
......
......@@ -97,7 +97,9 @@ msg_mclass_t *msg_mclass_clone(msg_mclass_t const *old, int newsize, int empty)
if (newsize == 0)
newsize = old->mc_hash_size;
if (newsize < old->mc_hash_used) {
if (newsize < old->mc_hash_used ||
newsize > USHRT_MAX / sizeof(msg_header_t *)) {
errno = EINVAL;
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment