X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=rfc1524.c;h=bc954c7b09f9819a41e2bb9c9b245d6a470c87ca;hp=9b745b402fa239402c535ebe6c8376cdfa5ec727;hb=4282401a0bcdc285a228da4ad635cbf7baf71488;hpb=93b012884de4ca5e1f2550f767d0b8680b9c0e9f diff --git a/rfc1524.c b/rfc1524.c index 9b745b4..bc954c7 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -21,27 +21,28 @@ # include "config.h" #endif +#include +#include +#include + +#include +#include +#include +#include + #include #include #include #include #include +#include + +#include #include "mutt.h" #include "rfc1524.h" #include "attach.h" -#include "lib/debug.h" - -#include -#include -#include - -#include -#include -#include -#include - /* The command semantics include the following: * %s is the filename that contains the mail body data * %t is the content type, like text/plain @@ -68,7 +69,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type, if (option (OPTMAILCAPSANITIZE)) mutt_sanitize_filename (type, 0); - while (command[x] && x < clen && y < sizeof (buf)) { + while (command[x] && x < clen && y < ssizeof (buf)) { if (command[x] == '\\') { x++; buf[y++] = command[x++]; @@ -82,7 +83,7 @@ int rfc1524_expand_command (BODY * a, char *filename, char *_type, int z = 0; x++; - while (command[x] && command[x] != '}' && z < sizeof (param)) + while (command[x] && command[x] != '}' && z < ssizeof (param)) param[z++] = command[x++]; param[z] = '\0'; @@ -160,7 +161,7 @@ static int rfc1524_mailcap_parse (BODY * a, { FILE *fp; char *buf = NULL; - size_t buflen; + ssize_t buflen; char *ch; char *field; int found = FALSE; @@ -188,7 +189,7 @@ static int rfc1524_mailcap_parse (BODY * a, btlen = ch - type; if ((fp = fopen (filename, "r")) != NULL) { - while (!found && (buf = mutt_read_line (buf, &buflen, fp, &line)) != NULL) { + while (!found && (buf = mutt_read_line(buf, &buflen, fp, &line)) != NULL) { /* ignore comments */ if (*buf == '#') continue; @@ -264,7 +265,7 @@ static int rfc1524_mailcap_parse (BODY * a, * if this is the right entry. */ char *test_command = NULL; - size_t len; + ssize_t len; if (get_field_text (field + 4, &test_command, type, filename, line) && test_command) { @@ -367,7 +368,7 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry, while (!found && *curr) { x = 0; - while (*curr && *curr != ':' && x < sizeof (path) - 1) { + while (*curr && *curr != ':' && x < ssizeof (path) - 1) { path[x++] = *curr; curr++; } @@ -402,15 +403,8 @@ int rfc1524_mailcap_lookup (BODY * a, char *type, rfc1524_entry * entry, * Returns 1 if newfile specified */ -static void strnfcpy (char *d, char *s, size_t siz, size_t len) -{ - if (len > siz) - len = siz - 1; - m_strcpy(d, len, s); -} - int rfc1524_expand_filename (char *nametemplate, - char *oldfile, char *newfile, size_t nflen) + char *oldfile, char *newfile, ssize_t nflen) { int i, j, k, ps, r; char *s; @@ -493,7 +487,7 @@ int rfc1524_expand_filename (char *nametemplate, if (lmatch) *left = 0; else - strnfcpy (left, nametemplate, sizeof (left), i); + m_strncpy(left, sizeof(left), nametemplate, i); if (rmatch) *right = 0;