If we use n-paramater of strncmp as strlen, it will check only
Prefix of string.
For example,
char a[] = "asdf";
char b[] = "as";
then, strncmp(a, b, strlen(b)) will return 0, even if a and b is not equal.
To avoid this kind of problem, let we ensurely check end of comparitor is
delim or not.
Change-Id: I34b10a014cb06721af2cc92df06892bfb20bf6f3
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
}
// text-controller allows only plain text type.
- if(!strncmp(mimeType, MIME_TYPE_TEXT_PLAIN, strlen(MIME_TYPE_TEXT_PLAIN)))
+ if(!strncmp(mimeType, MIME_TYPE_TEXT_PLAIN, strlen(MIME_TYPE_TEXT_PLAIN) + 1 /* Compare include null-terminated char */))
{
EventHandler::PasteClipboardItemEvent(*this, data);
}
- else if(!strncmp(mimeType, MIME_TYPE_HTML, strlen(MIME_TYPE_HTML)))
+ else if(!strncmp(mimeType, MIME_TYPE_HTML, strlen(MIME_TYPE_HTML) + 1 /* Compare include null-terminated char */))
{
// This does not mean that text controls can parse html.
// This is temporary code, as text controls do not support html type data.