commit ffa37923f23ca22dac19045b84c2c0d15f2a83e8 from: Martijn van Duren date: Tue Apr 9 15:52:13 2019 UTC Fix line-counting by skipping over \r on the end of the line. Also fix wrong signature length check while here commit - b79a019c1e68e11fb473957d52f4ce81894a9333 commit + ffa37923f23ca22dac19045b84c2c0d15f2a83e8 blob - f50b3d4247972a5acef89f987ce3e3d2bd7eea4b blob + 6f8b7764e54899a504b1fd816914e883ae74ec93 --- main.c +++ main.c @@ -634,7 +634,8 @@ dkim_signature_normalize(struct dkim_session *session) char *sig = session->signature.signature; for (linelen = i = 0; sig[i] != '\0'; i++) { - if (sig[i] == '\n') { + if (sig[i] == '\r' && sig[i + 1] == '\n') { + i++; checkpoint = 0; linelen = 0; continue; @@ -650,7 +651,7 @@ dkim_signature_normalize(struct dkim_session *session) } continue; } - if (linelen > DKIM_SIGNATURE_LINELEN + 1 && checkpoint != 0) { + if (linelen > DKIM_SIGNATURE_LINELEN && checkpoint != 0) { for (skip = checkpoint + 1; sig[skip] == ' ' || sig[skip] == '\t'; skip++)