[systemd-commits] src/libsystemd
Tom Gundersen
tomegun at kemper.freedesktop.org
Sun Apr 5 03:41:58 PDT 2015
src/libsystemd/sd-device/device-private.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
New commits:
commit de9b34b6d4250056ae2c483cf22844880504bccc
Author: Tom Gundersen <teg at jklm.no>
Date: Sun Apr 5 12:17:29 2015 +0200
sd-device: don't use alloca() within loops
I shall not use alloca() within loops
I shall not use alloca() within loops
I shall not use alloca() within loops
I shall not use alloca() within loops
...
diff --git a/src/libsystemd/sd-device/device-private.c b/src/libsystemd/sd-device/device-private.c
index 86d760c..9788df7 100644
--- a/src/libsystemd/sd-device/device-private.c
+++ b/src/libsystemd/sd-device/device-private.c
@@ -423,9 +423,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
size_t l;
FOREACH_WORD(word, l, value, state) {
- char *devlink;
+ char devlink[l + 1];
- devlink = strndupa(word, l);
+ strncpy(devlink, word, l);
+ devlink[l] = '\0';
r = device_add_devlink(device, devlink);
if (r < 0)
@@ -436,9 +437,10 @@ static int device_amend(sd_device *device, const char *key, const char *value) {
size_t l;
FOREACH_WORD_SEPARATOR(word, l, value, ":", state) {
- char *tag;
+ char tag[l + 1];
- tag = strndupa(word, l);
+ (void)strncpy(tag, word, l);
+ tag[l] = '\0';
r = device_add_tag(device, tag);
if (r < 0)
More information about the systemd-commits
mailing list