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

sizeof(char) == 1, and sizeof(array) is not the number of elements.


diffs (30 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -2672,7 +2672,7 @@ mapi_start_talking(Mapi mid)
                        }
 
                        free(mid->password);
-                       mid->password = malloc(sizeof(char) * (1 + 
strlen(pwdhash) + 1));
+                       mid->password = malloc(1 + strlen(pwdhash) + 1);
                        sprintf(mid->password, "\1%s", pwdhash);
                        free(pwdhash);
                }
@@ -2688,7 +2688,7 @@ mapi_start_talking(Mapi mid)
                                if (pwh == NULL)
                                        continue;
                                len = strlen(pwh) + 11 /* {RIPEMD160} */ + 1;
-                               hash = malloc(sizeof(char) * len);
+                               hash = malloc(len);
                                snprintf(hash, len, "{%s}%s", *algs, pwh);
                                free(pwh);
                                break;
@@ -2781,7 +2781,7 @@ mapi_start_talking(Mapi mid)
                                        break;
                                case '^':{
                                        char **r = mid->redirects;
-                                       int m = sizeof(mid->redirects) - 1;
+                                       int m = sizeof(mid->redirects) / 
sizeof(mid->redirects[0]) - 1;
                                        for (; *r != NULL && m > 0; r++)
                                                m--;
                                        if (m == 0)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to