aboutsummaryrefslogtreecommitdiff
path: root/src/pq/db_pq.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-03-24 00:08:33 +0100
committerChristian Grothoff <christian@grothoff.org>2015-03-24 00:08:33 +0100
commit6e28917a45fbeafe4e6515af07bac9ee484fb86c (patch)
tree4b10762f9d0094a43df0f7ffa73c912791aa1929 /src/pq/db_pq.c
parent373fe1c1389c1399217f37746459d0fb2cc0b53a (diff)
-fix comments
Diffstat (limited to 'src/pq/db_pq.c')
-rw-r--r--src/pq/db_pq.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/pq/db_pq.c b/src/pq/db_pq.c
index bfa929c4e..bbcf002ee 100644
--- a/src/pq/db_pq.c
+++ b/src/pq/db_pq.c
@@ -181,13 +181,16 @@ TALER_DB_extract_amount_nbo (PGresult *result,
r_amount_nbo->value = *(uint32_t *) PQgetvalue (result, row, val_num);
r_amount_nbo->fraction = *(uint32_t *) PQgetvalue (result, row, frac_num);
- memset (r_amount_nbo->currency, 0, TALER_CURRENCY_LEN);
- // FIXME: overflow?
- len = PQgetlength (result, row, curr_num);
- len = GNUNET_MIN (TALER_CURRENCY_LEN, len);
- memcpy (r_amount_nbo->currency, PQgetvalue (result, row, curr_num), len);
- r_amount_nbo->currency[TALER_CURRENCY_LEN - 1] = '\0';
-
+ memset (r_amount_nbo->currency,
+ 0,
+ TALER_CURRENCY_LEN);
+ len = GNUNET_MIN (TALER_CURRENCY_LEN - 1,
+ PQgetlength (result, row, curr_num));
+ memcpy (r_amount_nbo->currency,
+ PQgetvalue (result,
+ row,
+ curr_num),
+ len);
return GNUNET_OK;
}