| changeset 874: | 57268f4aaa94 |
|---|---|
| parent 873: | 93c6f460a6e7 |
| child 875: | 06e0c2cdb64f |
| author: | Simon Horman <horms@verge.net.au> |
| date: | Mon Sep 27 23:17:25 2010 +0900 (2 years ago) |
| files: | perdition/db/odbc/perditiondb_odbc.c perdition/io.c perdition/perdition.c |
| description: | 8/4byte integer type miss-matches On some architectures (e.g. x86_64) ssize_t and long are 8 bytes wide whereas int is only 4 bytes wide. This can cause at best unexpected negative or truncated values and at worse stack corruption. Thanks to Sergio Gelato for pointing this out. Cc: Sergio Gelato <Sergio.Gelato@astro.su.se> Signed-off-by: Simon Horman <horms@verge.net.au> |
1--- a/perdition/db/odbc/perditiondb_odbc.c Mon Sep 13 17:34:39 2010 +0900 2+++ b/perdition/db/odbc/perditiondb_odbc.c Mon Sep 27 23:17:25 2010 +0900 3@@ -214,7 +214,7 @@ 4 char **str_return, size_t * len_return) 5 { 6 SQLINTEGER rc; 7- SQLINTEGER rc2; 8+ SQLLEN rc2; 9 int status = -1; 10 SQLHENV env; 11 SQLHDBC hdbc;
1.1--- a/perdition/io.c Mon Sep 13 17:34:39 2010 +0900 1.2+++ b/perdition/io.c Mon Sep 27 23:17:25 2010 +0900 1.3@@ -655,7 +655,7 @@ 1.4 * 0 otherwise (one of io_a or io_b closes gracefully) 1.5 **********************************************************************/ 1.6 1.7-static int __io_pipe_read(int fd, void *buf, size_t count, void *data){ 1.8+static ssize_t __io_pipe_read(int fd, void *buf, size_t count, void *data){ 1.9 io_t *io; 1.10 io_select_t *s; 1.11 ssize_t bytes; 1.12@@ -693,7 +693,9 @@ 1.13 } 1.14 1.15 1.16-static int __io_pipe_write(int fd, const void *buf, size_t count, void *data){ 1.17+static ssize_t 1.18+__io_pipe_write(int fd, const void *buf, size_t count, void *data) 1.19+{ 1.20 io_t *io; 1.21 io_select_t *s; 1.22
2.1--- a/perdition/perdition.c Mon Sep 13 17:34:39 2010 +0900 2.2+++ b/perdition/perdition.c Mon Sep 27 23:17:25 2010 +0900 2.3@@ -309,14 +309,14 @@ 2.4 } 2.5 2.6 static void perdition_log_close(const char *from_to_host_str, 2.7- struct auth *auth, int received, int sent) 2.8+ struct auth *auth, size_t received, size_t sent) 2.9 { 2.10 struct quoted_str authorisation_id = quote_str(auth->authorisation_id); 2.11 2.12 VANESSA_LOGGER_ERR_UNSAFE("Closing session:%s " 2.13 "authorisation_id=%s%s%s " 2.14 "authentication_id=\"%s\" " 2.15- "received=%d sent=%d", 2.16+ "received=%zu sent=%zu", 2.17 from_to_host_str, 2.18 authorisation_id.quote, 2.19 authorisation_id.str,