Assure $anon_token_id is integer.

The code that currently calls this only ever passes in a value that was
returned by elec_verify_voted_token() and as such no security issue
existed here.

However, assuming this function might be used for someone else in
future, we might as well case the value back to integer "just in case".

HT Tobias Mueller <muelli@cryptobitch.de> who pointed this out.
This commit is contained in:
Bradley M. Kuhn 2015-05-14 15:25:28 -07:00
parent fe2896a094
commit 61d0c39379

View file

@ -205,7 +205,7 @@ function elec_choices_get_by_anon_token_id ($handle, $anon_token_id) {
$query = "SELECT c.choice, c.id FROM ";
$query .= $choices_table . " c, " . $anon_tokens_table . " a";
$query .= " WHERE c.election_id = a.election_id";
$query .= " AND a.id = " . $anon_token_id;
$query .= " AND a.id = " . intval($anon_token_id);
$query .= " ORDER BY c.id";