summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2022-11-23 19:49:06 +0100
committerLuke from DC <[email protected]>2022-12-23 11:01:23 +0000
commit26adade4d1fd1ff510d9f0dfa5abc576a68e6519 (patch)
tree792f8de0794ccc2b4c432adebc4f742fb2eabb34 /libcaja-private
parent333e2728dbebb12110fc9b2c821089eb372ee14e (diff)
downloadcaja-26adade4d1fd1ff510d9f0dfa5abc576a68e6519.tar.bz2
caja-26adade4d1fd1ff510d9f0dfa5abc576a68e6519.tar.xz
Fix handling of invalid x-special/mate-icon-list drops
`p` actually could never be `0` (because of the NULL check on the `memchr()` call), but the intended behavior is `*p == '\0'`: the containing condition checks for either a truncated data (`*p == '\0'`) or no geometry information (`*p == '\n'`). I replaced the check to be `*p != '\n'` instead of `*p == '\0'` to make this more robust as the actual issue is anything but a newline, the fact it can only be a NUL otherwise is incidental to the enclosing check, but not really relevant at this level. This is also in line with the actual error message. Found by cppcheck: https://caja.mate-desktop.dev/2022-11-23-174623-5790-cppcheck@ae663c369cf2_desktop-no-overflow/16.html#line-204
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-dnd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcaja-private/caja-dnd.c b/libcaja-private/caja-dnd.c
index 65918b08..b2a7601c 100644
--- a/libcaja-private/caja-dnd.c
+++ b/libcaja-private/caja-dnd.c
@@ -204,7 +204,7 @@ caja_drag_build_selection_list (GtkSelectionData *data)
if (*p == '\n' || *p == '\0')
{
result = g_list_prepend (result, item);
- if (p == 0)
+ if (*p != '\n')
{
g_warning ("Invalid x-special/mate-icon-list data received: "
"missing newline character.");