You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several issues with this parser's naïve .desktop parser:
If the file doesn't contain a [Desktop Entry] section header, an empty app struct is returned
If any fields are missing, even if they're necessary for parsing, they're simply left as NULL pointers
There is at least a crash in compare_app_name in either of those cases, if both the name_localized and name fields of any .desktop file are left uninitialized after the struct is calloc'd. Any others may also result in different crashes elsewhere.
I'm not sure which fields are absolutely mandatory for the menu generator to function, so I'll leave it up to someone familiar with the rest of the code to add the necessary validation.
At the very least, all mandatory headers should be checked for presence after parsing the .desktop file, then the app struct should be cleaned up and a NULL returned if the .desktop turns out to be invalid.
The example in my case, somehow, the Arch User Repository package gqrx-nrsc5-git installs an invalid .desktop file in /usr/share/applications, which contains only the following line and nothing more:
StartupNotify=false
(Incidentally, this was caught by a PKGBUILD not being updated past the point of the upstream .desktop file being renamed, which causes it to append a string to a non-existent file and install that in the package.)
The text was updated successfully, but these errors were encountered:
Handle null pointers in compare_app_name().
Do not create an entry unless a file contains a `[Desktop Entry]`
section and a `Name=` field.
Reported-by: @kode54Fixes: #15
There are several issues with this parser's naïve .desktop parser:
[Desktop Entry]
section header, an empty app struct is returnedThere is at least a crash in
compare_app_name
in either of those cases, if both thename_localized
andname
fields of any .desktop file are left uninitialized after the struct is calloc'd. Any others may also result in different crashes elsewhere.I'm not sure which fields are absolutely mandatory for the menu generator to function, so I'll leave it up to someone familiar with the rest of the code to add the necessary validation.
At the very least, all mandatory headers should be checked for presence after parsing the .desktop file, then the
app
struct should be cleaned up and a NULL returned if the .desktop turns out to be invalid.The example in my case, somehow, the Arch User Repository package
gqrx-nrsc5-git
installs an invalid .desktop file in/usr/share/applications
, which contains only the following line and nothing more:(Incidentally, this was caught by a PKGBUILD not being updated past the point of the upstream .desktop file being renamed, which causes it to append a string to a non-existent file and install that in the package.)
The text was updated successfully, but these errors were encountered: