comparison f-demime/header_end.c @ 2:1857d0d5a7bd

f-demime: fix parsing of Content-* headers
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 May 2023 06:33:26 +0000
parents 7e0d08176f32
children
comparison
equal deleted inserted replaced
1:05651a1b8ba8 2:1857d0d5a7bd
112 112
113 static int 113 static int
114 parse_content_type(type, subtype, charset, boundary) 114 parse_content_type(type, subtype, charset, boundary)
115 char *type, *subtype, *charset, *boundary; 115 char *type, *subtype, *charset, *boundary;
116 { 116 {
117 char *ctstr = cont_type_buf; 117 char *ctstr;
118 char tokbuf[HDR_BUF_SIZE], attr[HDR_BUF_SIZE]; 118 char tokbuf[HDR_BUF_SIZE], attr[HDR_BUF_SIZE];
119 int rc; 119 int rc;
120 120
121 ctstr = index(cont_type_buf, ':') + 1;
121 if (gettoken(&ctstr, type) != 1) 122 if (gettoken(&ctstr, type) != 1)
122 return(-1); 123 return(-1);
123 if (gettoken(&ctstr, tokbuf) != '/') 124 if (gettoken(&ctstr, tokbuf) != '/')
124 return(-1); 125 return(-1);
125 if (gettoken(&ctstr, subtype) != 1) 126 if (gettoken(&ctstr, subtype) != 1)
148 149
149 static int 150 static int
150 parse_content_te(ctetoken) 151 parse_content_te(ctetoken)
151 char *ctetoken; 152 char *ctetoken;
152 { 153 {
153 char *ctestr = cont_te_buf; 154 char *ctestr;
154 char tokbuf[HDR_BUF_SIZE]; 155 char tokbuf[HDR_BUF_SIZE];
155 156
157 ctestr = index(cont_te_buf, ':') + 1;
156 if (gettoken(&ctestr, ctetoken) != 1) 158 if (gettoken(&ctestr, ctetoken) != 1)
157 return(-1); 159 return(-1);
158 if (gettoken(&ctestr, tokbuf) == 0) 160 if (gettoken(&ctestr, tokbuf) == 0)
159 return(0); 161 return(0);
160 else 162 else