Systemd/src/shared
Goffredo Baroncelli f27f0e2177 core: fix crashes if locale.conf contains invalid utf-8 string
In the parse_env_file_push() and load_env_file_push() functions, there
are two assert() call to check if the key or value parameters are utf8 valid.

If the strings aren't utf8 valid, assert does abort.

These function are used early by systemd to parse some files. For
example '/etc/locale.conf'. In my case this file contained a not utf8
sequence, which is bad, but systemd crashed during the boot, which
is even worse!

The enclosed patch removes the assert and return -EINVAL if the
sequence is invalid. This is possible because the caller of these
function [1] checks the errors.
So the check of an invalid utf8 sequence is still performed, but
systemd doesn't crash anymore and logs the error.

[1] parse_env_file_internal(), invoked by load_env_file() and
parse_env_file()
2014-02-08 13:07:39 -05:00
..
linux trivial coding style clean ups 2013-12-03 22:27:45 +01:00
.gitignore build-sys: move more files from core/ to share/ that are generic enough 2013-11-22 16:31:40 +01:00
acl-util.c journald: DO recalculate the ACL mask, but only if it doesn't exist 2013-05-30 00:43:39 -04:00
acl-util.h journald: DO recalculate the ACL mask, but only if it doesn't exist 2013-05-30 00:43:39 -04:00
acpi-fpdt.c acpi-fpdt: break on zero or negative length read 2013-11-07 01:23:54 -05:00
acpi-fpdt.h support acpi firmware performance data (FPDT) 2013-09-24 15:43:41 +02:00
apparmor-util.c security: rework selinux, smack, ima, apparmor detection logic 2013-10-10 16:35:44 +02:00
apparmor-util.h security: rework selinux, smack, ima, apparmor detection logic 2013-10-10 16:35:44 +02:00
ask-password-api.c always use the same code for creating temporary files 2014-01-28 13:47:35 +01:00
ask-password-api.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
audit.c shared: procfs_file_alloca: handle pid==0 2014-01-05 00:59:13 -05:00
audit.h use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
boot-timestamps.c support acpi firmware performance data (FPDT) 2013-09-24 15:43:41 +02:00
boot-timestamps.h support acpi firmware performance data (FPDT) 2013-09-24 15:43:41 +02:00
bus-errors.h core: when an already abandoned unit gets abandoned again generate a clean error 2014-02-07 19:26:49 +01:00
calendarspec.c calendar: support 'yearly' and 'annually' names the same way as cron 2013-11-20 19:36:14 +01:00
calendarspec.h timer: implement calendar time events 2012-11-23 21:37:58 +01:00
capability.c Introduce cleanup functions for cap_free 2014-01-02 19:45:48 -05:00
capability.h Introduce cleanup functions for cap_free 2014-01-02 19:45:48 -05:00
cgroup-show.c Get rid of our reimplementation of basename 2013-12-06 21:29:55 -05:00
cgroup-show.h use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
cgroup-util.c cgroup: make sure to properly send SIGCONT to all processes of a cgroup if that's requested 2014-02-07 15:14:36 +01:00
cgroup-util.h bus: properly shift cgroup data returned from kdbus by the container's root before parsing 2013-12-24 19:31:44 +01:00
conf-files.c conf-files: replace readdir_r with readdir 2013-12-21 18:35:55 -05:00
conf-files.h use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
conf-parser.c conf-parser: warn when we open configuration files with weird access bits 2014-02-03 19:59:18 +01:00
conf-parser.h manager: add systemd.show_status=auto mode 2014-01-27 23:17:03 -05:00
def.h journal: guarantee async-signal-safety in sd_journald_sendv 2014-01-27 23:17:02 -05:00
dev-setup.c exec: introduce PrivateDevices= switch to provide services with a private /dev 2014-01-20 21:28:37 +01:00
dev-setup.h exec: introduce PrivateDevices= switch to provide services with a private /dev 2014-01-20 21:28:37 +01:00
device-nodes.c shared: device-nodes - add include guard 2013-09-24 15:34:57 +02:00
device-nodes.h shared: device-nodes - add include guard 2013-09-24 15:34:57 +02:00
efivars.c Modernization 2013-10-13 17:56:54 -04:00
efivars.h support acpi firmware performance data (FPDT) 2013-09-24 15:43:41 +02:00
env-util.c core: clean up environment block for --user instances a bit 2014-01-12 19:41:57 +08:00
env-util.h core: clean up environment block for --user instances a bit 2014-01-12 19:41:57 +08:00
errno-list.c bus: rework sd_bus_error APIs 2013-11-22 04:23:22 +01:00
errno-list.h bus: rework sd_bus_error APIs 2013-11-22 04:23:22 +01:00
exit-status.c manager: add systemd.show_status=auto mode 2014-01-27 23:17:03 -05:00
exit-status.h manager: add systemd.show_status=auto mode 2014-01-27 23:17:03 -05:00
fdset.c shared: move fdset.c from core/ to shared/ since it is used by more than the core now 2012-12-23 11:28:14 +01:00
fdset.h util: allow trailing semicolons on define_trivial_cleanup_func lines 2013-10-14 06:11:19 +02:00
fileio-label.c util: rename write_one_line_file() to write_string_file() 2013-04-03 20:12:56 +02:00
fileio-label.h util: rename write_one_line_file() to write_string_file() 2013-04-03 20:12:56 +02:00
fileio.c core: fix crashes if locale.conf contains invalid utf-8 string 2014-02-08 13:07:39 -05:00
fileio.h systemctl: add "systemctl cat" 2013-11-30 22:20:20 -05:00
gunicode.c unicode: treat cute symbol block as fullwidth 2013-10-13 17:56:54 -04:00
gunicode.h util, utf8: make ellipsize take multi-byte characters into account 2013-10-13 17:56:54 -04:00
hashmap.c use memzero(foo, length); for all memset(foo, 0, length); calls 2014-01-31 11:55:01 +01:00
hashmap.h shared: switch our hash table implementation over to SipHash 2013-12-22 21:12:25 +01:00
hwclock.c hwclock: modernizations 2013-11-20 19:36:14 +01:00
hwclock.h use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
ima-util.c security: missing header inclusions 2013-10-10 21:22:59 +02:00
ima-util.h security: rework selinux, smack, ima, apparmor detection logic 2013-10-10 16:35:44 +02:00
initreq.h build-sys: move more files from core/ to share/ that are generic enough 2013-11-22 16:31:40 +01:00
install-printf.c specifier: rework specifier calls to return proper error message 2013-09-17 10:06:50 -05:00
install-printf.h specifier: rework specifier calls to return proper error message 2013-09-17 10:06:50 -05:00
install.c shared/install: use char** convention for strvs 2014-01-05 09:16:15 -05:00
install.h shared/install: use char** convention for strvs 2014-01-05 09:16:15 -05:00
ioprio.h trivial coding style clean ups 2013-12-03 22:27:45 +01:00
label.c Remove duplicate includes 2013-11-18 20:28:55 -05:00
label.h udev: add SECLABEL{selinux}= support 2013-10-09 17:31:41 +02:00
list.h list: make our list macros a bit easier to use by not requring type spec on each invocation 2013-10-14 06:11:19 +02:00
log.c log: als turn on debug logging in non-PID1 if /proc/cmdline contains "debug" 2013-12-23 17:56:44 +01:00
log.h _noreturn_ --> noreturn for C11 compat 2013-12-17 21:51:24 +01:00
logs-show.c bus: when getting a kdbus connection into a container wait first for child, then read message 2013-12-23 19:10:11 +01:00
logs-show.h journal: add ability to browse journals of running OS containers 2013-12-11 22:04:03 +01:00
macro.h journald: do not free space when disk space runs low 2014-01-11 16:54:59 -05:00
Makefile
missing.h Base mkostemp_safe on mkostemp 2014-01-28 19:07:13 -05:00
mkdir-label.c shared: split mkdir_*() and mkdir_*_label() from each other 2013-07-26 04:13:55 +02:00
mkdir.c mkdir: pass a proper function pointer to mkdir_safe_internal 2013-10-02 19:45:12 +02:00
mkdir.h mkdir: modernize header ifdefs 2013-11-06 23:03:12 +01:00
MurmurHash2.c libudev: ship the original MurmurHash2.[ch] file 2013-12-23 02:55:06 +01:00
MurmurHash2.h libudev: ship the original MurmurHash2.[ch] file 2013-12-23 02:55:06 +01:00
net-util.c shared: net - use u32ctz to compute prefixlen 2014-01-30 17:23:34 +01:00
net-util.h sd-dhcp-client/net-util: make netmask_to_prefixlen generic 2014-01-30 14:30:39 +01:00
output-mode.h logs-show: add short-precise mode with us timestamps 2013-08-20 21:18:43 -04:00
pager.c _noreturn_ --> noreturn for C11 compat 2013-12-17 21:51:24 +01:00
pager.h Add __attribute__((const, pure, format)) in various places 2013-05-02 22:52:09 -04:00
path-lookup.c strv: multiple cleanups 2014-01-05 09:16:15 -05:00
path-lookup.h path_lookup: moved _cleanup_lookup_paths_free_ from install.c to path-lookup.h 2013-10-27 11:51:22 -04:00
path-util.c No need to canonicalize fixed paths 2014-01-08 22:15:27 -05:00
path-util.h No need to canonicalize fixed paths 2014-01-08 22:15:27 -05:00
prioq.c core: convert PID 1 to libsystemd-bus 2013-11-20 20:52:36 +01:00
prioq.h bus: add minimal event loop API 2013-10-10 04:44:48 +02:00
ptyfwd.c Revert "ptyfwd: make master terminal attributes raw, too" 2013-12-18 19:26:10 +01:00
ptyfwd.h nspawn: split out pty forwaring logic into ptyfwd.c 2013-10-31 01:43:38 +01:00
ratelimit.c ratelimit: fix off-by-one 2013-02-13 08:45:13 -05:00
ratelimit.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
refcnt.h bus: make bus ref counting atomic 2013-05-16 21:58:34 +02:00
replace-var.c Verify validity of session name when received from outside 2013-09-16 09:58:37 -05:00
replace-var.h shared: add API for replacing @FOO@ style variables in strings 2012-11-14 22:21:16 +01:00
securebits.h build-sys: move more files from core/ to share/ that are generic enough 2013-11-22 16:31:40 +01:00
selinux-util.c security: rework selinux, smack, ima, apparmor detection logic 2013-10-10 16:35:44 +02:00
selinux-util.h selinux: rework selinux access check logic 2012-10-02 17:07:00 -04:00
set.c core: serialize/deserialize bus subscribers 2013-07-10 23:41:03 +02:00
set.h util: allow trailing semicolons on define_trivial_cleanup_func lines 2013-10-14 06:11:19 +02:00
siphash24.c shared: switch our hash table implementation over to SipHash 2013-12-22 21:12:25 +01:00
siphash24.h shared: switch our hash table implementation over to SipHash 2013-12-22 21:12:25 +01:00
sleep-config.c sleep-config: fix double free 2013-12-31 13:00:57 -05:00
sleep-config.h systemd-sleep: add support for freeze and standby 2013-05-06 22:51:57 +02:00
smack-util.c smack: minimize ifdef use, and move all labeling to smack-util.c 2013-10-11 10:16:41 +02:00
smack-util.h smack: minimize ifdef use, and move all labeling to smack-util.c 2013-10-11 10:16:41 +02:00
socket-label.c active: rework make_socket_fd() to be based on socket_address_listen() 2013-11-06 23:03:12 +01:00
socket-util.c shared: fix getpeername_pretty() for AF_UNIX sockets 2013-12-25 01:29:55 +01:00
socket-util.h shared: Add struct sockaddr_ll to sockaddr_union 2013-12-12 11:43:34 -05:00
sparse-endian.h shared: move sparse-endian.h from journal 2012-10-22 18:08:48 +02:00
spawn-ask-password-agent.c
spawn-ask-password-agent.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
spawn-polkit-agent.c build-sys: make PolicyKit support compile-time optional (was runtime-optional already) 2013-02-13 23:08:25 +01:00
spawn-polkit-agent.h use #pragma once instead of foo*foo define guards 2013-11-18 20:28:54 -05:00
special.h bus: add .busname unit type to implement kdbus-style bus activation 2013-12-02 23:32:34 +01:00
specifier.c specifier: rework specifier calls to return proper error message 2013-09-17 10:06:50 -05:00
specifier.h specifier: rework specifier calls to return proper error message 2013-09-17 10:06:50 -05:00
strbuf.c Fix spelling errors using 'codespell' tool 2013-04-15 08:40:05 -04:00
strbuf.h use the same email address everywhere 2012-11-12 19:47:43 +01:00
strv.c strv: multiple cleanups 2014-01-05 09:16:15 -05:00
strv.h strv: multiple cleanups 2014-01-05 09:16:15 -05:00
strxcpyx.c trivial coding style clean ups 2013-12-03 22:27:45 +01:00
strxcpyx.h macro: clean up usage of gcc attributes 2013-10-16 06:14:59 +02:00
syscall-list.c build-sys: move more files from core/ to share/ that are generic enough 2013-11-22 16:31:40 +01:00
syscall-list.h build-sys: move more files from core/ to share/ that are generic enough 2013-11-22 16:31:40 +01:00
test-tables.h test-tables: allow sparse tables and check mapping for -1 2013-07-16 12:04:31 -04:00
time-dst.c time-dst: use _cleanup_ 2013-05-02 22:55:38 -04:00
time-dst.h timedatectl: properly print 30 minutes DST transitions 2012-11-11 16:55:25 +01:00
time-util.c logging: reduce send timeout to something more sensible 2013-12-20 22:47:26 -05:00
time-util.h Use format patterns for usec_t, pid_t, nsec_t, usec_t 2014-01-02 19:45:47 -05:00
udev-util.h udevadm: modernization 2013-12-18 23:58:23 -05:00
unit-name.c Use enums to make it obvious what boolean params mean 2013-12-26 15:49:54 -05:00
unit-name.h Use enums to make it obvious what boolean params mean 2013-12-26 15:49:54 -05:00
utf8.c utf8: export utf8 validation functions as part of sd-bus 2013-11-07 03:07:40 +01:00
utf8.h utf8: ascii_filter() is unused, let's remove it 2013-11-07 03:06:37 +01:00
util.c conf-parser: warn when we open configuration files with weird access bits 2014-02-03 19:59:18 +01:00
util.h conf-parser: warn when we open configuration files with weird access bits 2014-02-03 19:59:18 +01:00
utmp-wtmp.c utmp: make sure we don't write the utmp reboot record twice on each boot 2014-01-30 14:18:46 +01:00
utmp-wtmp.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
virt.c __thread --> thread_local for C11 compat 2013-12-17 21:45:43 +01:00
virt.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
watchdog.c util: make time formatting a bit smarter 2013-04-04 02:56:56 +02:00
watchdog.h use #pragma once instead of foo*foo #define guards 2012-07-19 12:30:59 +02:00
xml.c shared: add simplistic XML parser for usage in the D-Bus policy language compat parser 2013-12-28 03:04:29 +01:00
xml.h shared: add simplistic XML parser for usage in the D-Bus policy language compat parser 2013-12-28 03:04:29 +01:00