Due to some missing '()' ( (...)?resource.len:event.len + 1
instead of ((...)?resource.len:event.len) + 1 ) sometimes the
memory allocated was less with one byte then what was needed.
The fixed version also replaces ?: with MAX_unsigned() (does the
same thing and it's easier to read).
Reported-by: Andres Moya andres.moya.i gmail com
(cherry picked from commit 229bd1f517cb9177dc731929c31153b2b9513215)