]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Replace some t_malloc_no0 calls with t_malloc0
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 17 May 2016 08:38:14 +0000 (11:38 +0300)
committerGitLab <gitlab@git.dovecot.net>
Mon, 30 May 2016 18:35:24 +0000 (21:35 +0300)
This might increase safety.

src/lib-imap/imap-date.c
src/lib-imap/imap-utf7.c
src/lib-index/test-mail-index-sync-ext.c
src/lib-ssl-iostream/iostream-openssl-common.c
src/lib-ssl-iostream/iostream-openssl.c
src/login-common/ssl-proxy-openssl.c

index 0be4fd23f9e2c0a52eeda72360bcd68f7dadf6a3..23a810c47356f0e4b9c9e31d155964499ff11d88 100644 (file)
@@ -183,7 +183,7 @@ imap_to_datetime_tm(const struct tm *tm, int timezone_offset)
        char *buf;
 
        /* @UNSAFE: but faster than t_strdup_printf() call.. */
-       buf = t_malloc_no0(27);
+       buf = t_malloc0(27);
        imap_to_date_tm(buf, tm);
        buf[11] = ' ';
 
index 87ea8194d8357826201c5b3604838129caaf9908..86fc1d2123077c93159c2bfc27bc3987071e8e17 100644 (file)
@@ -82,7 +82,7 @@ int imap_utf8_to_utf7(const char *src, string_t *dest)
 
        /* at least one encoded character */
        str_append_n(dest, src, p-src);
-       utf16 = t_malloc_no0(strlen(p)*2);
+       utf16 = t_malloc0(strlen(p)*2);
        while (*p != '\0') {
                if (*p == '&') {
                        str_append(dest, "&-");
index 34c7b6d0b279ae1fda75f1bee58acbb9c0fa2174..401118edd35068ff684f3c0b4e7dbb4b0fcd595b 100644 (file)
@@ -48,7 +48,7 @@ static void test_mail_index_sync_ext_atomic_inc(void)
        ctx.view->map->hdr.record_size = sizeof(struct mail_index_record) + 16;
        ctx.view->map->rec_map = t_new(struct mail_index_record_map, 1);
        ctx.view->map->rec_map->records =
-               t_malloc_no0(ctx.view->map->hdr.record_size);
+               t_malloc0(ctx.view->map->hdr.record_size);
        t_array_init(&ctx.view->map->extensions, 4);
        ext = array_append_space(&ctx.view->map->extensions);
        ext->record_offset = sizeof(struct mail_index_record);
index 52e38c5c697306327c940bd104256a89fa4d4e1d..ef0228809ff12f1e3a9493ae06f3bf09a5458014 100644 (file)
@@ -174,8 +174,7 @@ static const char *ssl_err2str(unsigned long err, const char *data, int flags)
        char *buf;
        size_t err_size = 256;
 
-       buf = t_malloc_no0(err_size);
-       buf[err_size-1] = '\0';
+       buf = t_malloc0(err_size);
        ERR_error_string_n(err, buf, err_size-1);
        ret = buf;
 
index daccb298bcc5cd94b067dfd86553efa3f1307df0..18b2e43bc06efbbdbbc81ecc233bc367d6707262 100644 (file)
@@ -664,7 +664,7 @@ openssl_iostream_get_peer_name(struct ssl_iostream *ssl_io)
        if (len < 0)
                name = "";
        else {
-               name = t_malloc_no0(len + 1);
+               name = t_malloc0(len + 1);
                if (X509_NAME_get_text_by_NID(X509_get_subject_name(x509),
                                              ssl_io->username_nid,
                                              name, len + 1) < 0)
index be2bcdc6a5afb494ca38a5a427f73fa20c3ce98f..8f03438ccad30eff105f126df1f3e680a804fccc 100644 (file)
@@ -701,7 +701,7 @@ const char *ssl_proxy_get_peer_name(struct ssl_proxy *proxy)
        if (len < 0)
                name = "";
        else {
-               name = t_malloc_no0(len + 1);
+               name = t_malloc0(len + 1);
                if (X509_NAME_get_text_by_NID(X509_get_subject_name(x509),
                                        ssl_username_nid, name, len + 1) < 0)
                        name = "";