talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 2b08f7b5611ccd27ee45339ab2b302f9d6f28f24
parent 8168ea7cef941c9f497a1ec6ce6300ad5dad3d74
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 20 Nov 2025 14:38:04 +1100

misc strlcat, GNU-ism fix

Diffstat:
Msrc/addrbook.c | 15+++++----------
Msrc/mbox.c | 6++----
2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/addrbook.c b/src/addrbook.c @@ -1813,17 +1813,12 @@ GList *addrbook_get_bookfile_list(AddressBookFile *book) { return NULL; } - strncpy(buf, book->path, WORK_BUFLEN); - len = strlen(buf); - if (len > 0) { - if (buf[len-1] != G_DIR_SEPARATOR) { - buf[len] = G_DIR_SEPARATOR; - buf[++len] = '\0'; - } - } + strlcpy(buf, book->path, sizeof(buf)); + if (buf[strlen(buf)] != '/') + strlcat(buf, "/", sizeof(buf)); - adbookdir = g_strdup(buf); - strncat(buf, ADDRBOOK_PREFIX, WORK_BUFLEN - strlen(buf)); + adbookdir = strdup(buf); + strlcat(buf, ADDRBOOK_PREFIX, sizeof(buf)); if( ( dir = g_dir_open( adbookdir, 0, NULL ) ) == NULL ) { book->retVal = MGU_OPEN_DIRECTORY; diff --git a/src/mbox.c b/src/mbox.c @@ -40,8 +40,6 @@ #include "statusbar.h" #include "file-utils.h" -#define MESSAGEBUFSIZE 8192 - #define FPUTS_TO_TMP_ABORT_IF_FAIL(s) \ { \ lines++; \ @@ -59,7 +57,7 @@ gint proc_mbox(FolderItem *dest, const gchar *mbox, PrefsAccount *account) /* return values: -1 error, >=0 number of msgs added */ { FILE *mbox_fp; - gchar buf[MESSAGEBUFSIZE]; + char buf[BUFSIZ]; gchar *tmp_file; gint msgs = 0; gint lines; @@ -253,7 +251,7 @@ gint copy_mbox(gint srcfd, const gchar *dest) { FILE *dest_fp; ssize_t n_read; - gchar buf[BUFSIZ]; + char buf[BUFSIZ]; gboolean err = FALSE; int save_errno = 0;