/* Fail state, skip line */
if (*p == '\r') {
- if (*(p + 1) == '\n') {
+ if (p + 1 < end && *(p + 1) == '\n') {
nlines_count[RSPAMD_TASK_NEWLINES_CRLF] ++;
p++;
}
else if (*p == '\n') {
nlines_count[RSPAMD_TASK_NEWLINES_LF] ++;
- if (*(p + 1) == '\r') {
+ if (p + 1 < end && *(p + 1) == '\r') {
p++;
}
p++;
rspamd_cryptobox_hash_state_t hs;
guchar hout[rspamd_cryptobox_HASHBYTES], *hexout;
- for (gint i = 0; i < RSPAMD_TASK_NEWLINES_MAX; i ++) {
+ for (gint i = RSPAMD_TASK_NEWLINES_CR; i < RSPAMD_TASK_NEWLINES_MAX; i ++) {
if (nlines_count[i] > max_cnt) {
max_cnt = nlines_count[i];
sel = i;
#endif
enum rspamd_newlines_type {
- RSPAMD_TASK_NEWLINES_CR,
+ RSPAMD_TASK_NEWLINES_CR = 0,
RSPAMD_TASK_NEWLINES_LF,
RSPAMD_TASK_NEWLINES_CRLF,
RSPAMD_TASK_NEWLINES_MAX