summaryrefslogtreecommitdiffstats
path: root/web/lib/aur.inc
diff options
context:
space:
mode:
authorelij <elij.mx@gmail.com>2011-05-12 01:17:12 +0200
committerLukas Fleischer <archlinux@cryptocrack.de>2011-05-17 10:43:42 +0200
commit0898f1447a2d6bdc893f55f4718f867734841361 (patch)
tree22ab9736ad4b92af12daeb3a5215b126c3a8c22c /web/lib/aur.inc
parentd38f3460e55ad4e8486c63902f3b581684d6f188 (diff)
downloadaur-0898f1447a2d6bdc893f55f4718f867734841361.tar.gz
aur-0898f1447a2d6bdc893f55f4718f867734841361.tar.xz
test return value from db_query before assuming it is valid
make the sql query form consistent in usage by cleaning up instances where db_query's result was not inspected before attempting to fetch row data from the handle Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'web/lib/aur.inc')
-rw-r--r--web/lib/aur.inc8
1 files changed, 6 insertions, 2 deletions
diff --git a/web/lib/aur.inc b/web/lib/aur.inc
index 5eed8e74..fb267af8 100644
--- a/web/lib/aur.inc
+++ b/web/lib/aur.inc
@@ -491,8 +491,12 @@ function get_salt($user_id)
{
$dbh = db_connect();
$salt_q = "SELECT Salt FROM Users WHERE ID = " . $user_id;
- $salt_result = mysql_fetch_row(db_query($salt_q, $dbh));
- return $salt_result[0];
+ $result = db_query($salt_q, $dbh);
+ if ($result) {
+ $salt_row = mysql_fetch_row($result);
+ return $salt_row[0];
+ }
+ return;
}
function save_salt($user_id, $passwd)