- unsigned char *NxtHdr = hdrs;
- unsigned char *XferEnc, *XferEncOfs, *CntType, *MimeVer, *p;
- int HdrsFound = 0; /* We only look for three headers */
- int BodyType; /* Return value */
-
- /* Setup for a standard (no MIME, no QP, 7-bit US-ASCII) message */
- MultipartDelimiter[0] = '\0';
- CurrEncodingIsQP = CurrTypeNeedsDecode = 0;
- BodyState = S_BODY_DATA;
- BodyType = 0;
-
- /* Just in case ... */
- if (hdrs == NULL)
- return BodyType;
-
- XferEnc = XferEncOfs = CntType = MimeVer = NULL;
-
- do {
- if (strncasecmp("Content-Transfer-Encoding:", NxtHdr, 26) == 0) {
- XferEncOfs = NxtHdr;
- p = nxtaddr(NxtHdr);
- if (p != NULL) {
- xalloca(XferEnc, char *, strlen(p) + 1);
- strcpy(XferEnc, p);
- HdrsFound++;
- }
- }
- else if (strncasecmp("Content-Type:", NxtHdr, 13) == 0) {
- /*
- * This one is difficult. We cannot use the standard
- * nxtaddr() routine, since the boundary-delimiter is
- * (probably) enclosed in quotes - and thus appears
- * as an rfc822 comment, and nxtaddr() "eats" up any
- * spaces in the delimiter. So, we have to do this
- * by hand.
- */
+ char *NxtHdr = hdrs;
+ char *XferEnc, *XferEncOfs, *CntType, *MimeVer, *p;
+ int HdrsFound = 0; /* We only look for three headers */
+ int BodyType; /* Return value */
+
+ /* Setup for a standard (no MIME, no QP, 7-bit US-ASCII) message */
+ MultipartDelimiter[0] = '\0';
+ CurrEncodingIsQP = CurrTypeNeedsDecode = 0;
+ BodyState = S_BODY_DATA;
+ BodyType = 0;
+
+ /* Just in case ... */
+ if (hdrs == NULL)
+ return BodyType;
+
+ XferEnc = XferEncOfs = CntType = MimeVer = NULL;
+
+ do {
+ if (strncasecmp("Content-Transfer-Encoding:", NxtHdr, 26) == 0) {
+ XferEncOfs = NxtHdr;
+ p = nxtaddr(NxtHdr);
+ if (p != NULL) {
+ xfree(XferEnc);
+ XferEnc = xstrdup(p);
+ HdrsFound++;
+ }
+ }
+ else if (strncasecmp("Content-Type:", NxtHdr, 13) == 0) {
+ /*
+ * This one is difficult. We cannot use the standard
+ * nxtaddr() routine, since the boundary-delimiter is
+ * (probably) enclosed in quotes - and thus appears
+ * as an rfc822 comment, and nxtaddr() "eats" up any
+ * spaces in the delimiter. So, we have to do this
+ * by hand.
+ */
+
+ /* Skip the "Content-Type:" part and whitespace after it */
+ for (NxtHdr += 13; ((*NxtHdr == ' ') || (*NxtHdr == '\t')); NxtHdr++) { }