Changeset: 17e0f101fbbc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=17e0f101fbbc
Modified Files:
        clients/mapilib/mapi.c
Branch: Aug2011
Log Message:

mapi_start_talking: fix stack smashing problem

No idea why mid->password was copied in an alloca'd buffer, but previous
versions of the code might have changed the buffer.  In any case it is
not a good idea to just alloca a unknown-length buffer, which is what
GCC's stack-smashing-protector (SSP) is complaining about (Ubuntu has
this enabled by default).
Simplify the code, and omit the entire string copy, as it is not
necessary at all.


diffs (16 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2469,11 +2469,9 @@
                        if (mid->password[0] != '\1') {
                                unsigned char md[64];   /* should be 
SHA512_DIGEST_LENGTH */
                                size_t n = strlen(mid->password);
-                               char *key = alloca(n);
+                               char *key = mid->password;
                                int len;
 
-                               strncpy(key, mid->password, n);
-
 #ifdef HAVE_RIPEMD160
                                if (strcmp(serverhash, "RIPEMD160") == 0) {
                                        RIPEMD160((unsigned char *) key, n, md);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to