really carefully check strtoll() return value before casting to uint64_t
This commit is contained in:
parent
332a37292c
commit
d86a6615cc
@ -1941,6 +1941,7 @@ wire_transfer_information_cb (void *cls,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GNUNET_assert (NULL != dki); /* mostly to help static analysis */
|
||||||
/* Check transaction history to see if it supports aggregate
|
/* Check transaction history to see if it supports aggregate
|
||||||
valuation */
|
valuation */
|
||||||
check_transaction_history (coin_pub,
|
check_transaction_history (coin_pub,
|
||||||
|
@ -363,18 +363,22 @@ get_anchor_iter (void *cls,
|
|||||||
struct GNUNET_TIME_Absolute stamp;
|
struct GNUNET_TIME_Absolute stamp;
|
||||||
const char *base;
|
const char *base;
|
||||||
char *end = NULL;
|
char *end = NULL;
|
||||||
|
long long int bval;
|
||||||
|
|
||||||
base = GNUNET_STRINGS_get_short_name (filename);
|
base = GNUNET_STRINGS_get_short_name (filename);
|
||||||
stamp.abs_value_us = strtoll (base,
|
bval = strtoll (base,
|
||||||
&end,
|
&end,
|
||||||
10);
|
10);
|
||||||
if ((NULL == end) || (0 != *end))
|
if ( (NULL == end) ||
|
||||||
|
(0 != *end) ||
|
||||||
|
(0 > bval) )
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Ignoring unexpected file `%s'.\n",
|
"Ignoring unexpected file `%s'.\n",
|
||||||
filename);
|
filename);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
stamp.abs_value_us = (uint64_t) bval;
|
||||||
*anchor = GNUNET_TIME_absolute_max (stamp,
|
*anchor = GNUNET_TIME_absolute_max (stamp,
|
||||||
*anchor);
|
*anchor);
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user