icalmemory_strdup_and_dequote() will march past the null terminator if the last character is a backslash.
Updated the patch again. The last one was incorrectly leaving the escaped character in the string.
This patch sets a flag when it writes a null terminator to the destination so the for loop can short-circuit before it tries to read past the end of the source string.
committed in r1122. Thanks Kent!