diff options
Diffstat (limited to 'mailutils/mail.c')
-rw-r--r-- | mailutils/mail.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/mailutils/mail.c b/mailutils/mail.c index 7af7edd6c..2ad959f7d 100644 --- a/mailutils/mail.c +++ b/mailutils/mail.c | |||
@@ -109,6 +109,17 @@ static char* FAST_FUNC parse_url(char *url, char **user, char **pass) | |||
109 | 109 | ||
110 | void FAST_FUNC encode_base64(char *fname, const char *text, const char *eol) | 110 | void FAST_FUNC encode_base64(char *fname, const char *text, const char *eol) |
111 | { | 111 | { |
112 | size_t len = len; | ||
113 | if (text) { | ||
114 | // though we do not call uuencode(NULL, NULL) explicitly | ||
115 | // still we do not want to break things suddenly | ||
116 | len = strlen(text); | ||
117 | } | ||
118 | encode_n_base64(fname, text, len, eol); | ||
119 | } | ||
120 | |||
121 | void FAST_FUNC encode_n_base64(char *fname, const char *text, size_t len, const char *eol) | ||
122 | { | ||
112 | enum { | 123 | enum { |
113 | SRC_BUF_SIZE = 57, /* This *MUST* be a multiple of 3 */ | 124 | SRC_BUF_SIZE = 57, /* This *MUST* be a multiple of 3 */ |
114 | DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3), | 125 | DST_BUF_SIZE = 4 * ((SRC_BUF_SIZE + 2) / 3), |
@@ -116,17 +127,12 @@ void FAST_FUNC encode_base64(char *fname, const char *text, const char *eol) | |||
116 | #define src_buf text | 127 | #define src_buf text |
117 | char src[SRC_BUF_SIZE]; | 128 | char src[SRC_BUF_SIZE]; |
118 | FILE *fp = fp; | 129 | FILE *fp = fp; |
119 | ssize_t len = len; | ||
120 | char dst_buf[DST_BUF_SIZE + 1]; | 130 | char dst_buf[DST_BUF_SIZE + 1]; |
121 | 131 | ||
122 | if (fname) { | 132 | if (fname) { |
123 | fp = (NOT_LONE_DASH(fname)) ? xfopen_for_read(fname) : (FILE *)text; | 133 | fp = (NOT_LONE_DASH(fname)) ? xfopen_for_read(fname) : (FILE *)text; |
124 | src_buf = src; | 134 | src_buf = src; |
125 | } else if (text) { | 135 | } else if (!text) |
126 | // though we do not call uuencode(NULL, NULL) explicitly | ||
127 | // still we do not want to break things suddenly | ||
128 | len = strlen(text); | ||
129 | } else | ||
130 | return; | 136 | return; |
131 | 137 | ||
132 | while (1) { | 138 | while (1) { |