The change in vcf.c is not correct. content is not a null terminated string but a string split after the last UTF8 character. We want to split it, not to copy it entirely
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ah, in case I'm missing something g_strlcpy(buffer, content, len + 1); copies at most len characters and not the complete content string (which is NULL terminated btw which is why we could use strlen(content) at line 328).
I fail to understand how g_strlcpy(buffer, content, len + 1); is different than
strncpy(buffer,content,len);buffer[len]='\0';
the code before the proposed change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The change in vcf.c is not correct. content is not a null terminated string but a string split after the last UTF8 character. We want to split it, not to copy it entirely
Ah, in case I'm missing something
g_strlcpy(buffer, content, len + 1);copies at mostlencharacters and not the completecontentstring (which isNULLterminated btw which is why we could usestrlen(content)at line 328).I fail to understand how
g_strlcpy(buffer, content, len + 1);is different thanthe code before the proposed change.
Last edit: Avinash Sonawane 2020-11-22