chiark / gitweb /
[PATCH] udev - safer string handling all over the place
[elogind.git] / udevinfo.c
index b94376c9cee22131d7348f4f837982efc7bbe021..defed2ee31a96e38aeaae3d0346323d2af778097 100644 (file)
@@ -73,7 +73,7 @@ static int print_all_attributes(const char *path)
 
        dlist_for_each_data(attributes, attr, struct sysfs_attribute) {
                if (attr->value != NULL) {
 
        dlist_for_each_data(attributes, attr, struct sysfs_attribute) {
                if (attr->value != NULL) {
-                       strncpy(value, attr->value, SYSFS_VALUE_MAX);
+                       strfieldcpy(value, attr->value);
                        len = strlen(value);
                        if (len == 0)
                                continue;
                        len = strlen(value);
                        if (len == 0)
                                continue;
@@ -306,8 +306,8 @@ static int process_options(void)
                        } else {
                                if (path[0] != '/') {
                                        /* prepend '/' if missing */
                        } else {
                                if (path[0] != '/') {
                                        /* prepend '/' if missing */
-                                       strcat(temp, "/");
-                                       strncat(temp, path, sizeof(path));
+                                       strfieldcat(temp, "/");
+                                       strfieldcat(temp, path);
                                        pos = temp;
                                } else {
                                        pos = path;
                                        pos = temp;
                                } else {
                                        pos = path;
@@ -343,7 +343,7 @@ print:
                case NAME:
                        if (root)
                                strfieldcpy(result, udev_root);
                case NAME:
                        if (root)
                                strfieldcpy(result, udev_root);
-                       strncat(result, dev.name, sizeof(result));
+                       strfieldcat(result, dev.name);
                        break;
 
                case SYMLINK:
                        break;
 
                case SYMLINK:
@@ -385,7 +385,7 @@ exit:
                                /* prepend sysfs mountpoint if not given */
                                strfieldcpy(temp, path);
                                strfieldcpy(path, sysfs_path);
                                /* prepend sysfs mountpoint if not given */
                                strfieldcpy(temp, path);
                                strfieldcpy(path, sysfs_path);
-                               strncat(path, temp, sizeof(path));
+                               strfieldcat(path, temp);
                        }
                        print_device_chain(path);
                        return 0;
                        }
                        print_device_chain(path);
                        return 0;