Skip to content

Prevent abort on non-UTF-8 data loaded from storage

Giuseppe Eletto connman 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2technology: Ignore invalid UTF-8 tethering identifier and passphrasesrc/technology.c+16 -00 replies
2/2service: Ignore invalid UTF-8 service namesrc/service.c+8 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Prevent abort on non-UTF-8 data loaded from storage

While investigating a connmand crash loop on an i.MX91 based device I found that connmand aborts on start with SIGABRT raised from libdbus.

The global settings file contained a WiFi tethering identifier and/or passphrase that were no longer valid UTF-8:

[WiFi]
Tethering.Identifier=@?????
Tethering.Passphrase=PW\215\301\252\252

technology_load() loads these values and append_properties() hands them to D-Bus when the TechnologyAdded signal is emitted. libdbus aborts the whole process when a string that is not valid UTF-8 is appended to a message, so connmand crashes on every start and cannot recover without manually editing or removing the lines from the file:

Aborting (signal 6) [/usr/sbin/connmand]

  #6  libdbus-1.so.3  dbus_message_iter_append_basic
  #7  connmand        connman_dbus_dict_append_basic
  #8  connmand        append_properties
  #9  connmand        technology_added_signal
  #10 connmand        technology_dbus_register
  #11 connmand        technology_get

The same problem applies to the WiFi service name, which is also loaded verbatim from storage and exported over D-Bus.

This series makes connmand resilient to such corrupted data by validating the affected strings with g_utf8_validate() when they are loaded and ignoring the invalid ones. Values sent over D-Bus are always valid UTF-8, so only corrupted on-disk data is affected.

Giuseppe Eletto (2):
technology: Ignore invalid UTF-8 tethering identifier and passphrase
service: Ignore invalid UTF-8 service name

 src/service.c    |  8 ++++++++
 src/technology.c | 16 ++++++++++++++++
 2 files changed, 24 insertions(+)
Signature · 1 line
2.50.1