diff options
author | David Tardon <dtardon@redhat.com> | 2021-06-22 16:41:23 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2021-06-24 15:12:29 +0200 |
commit | 1001167ca5e4cfdc6230562e4fb9029e5f624d53 (patch) | |
tree | 07b609a26e11f68f5b43939fef2bb7899cf6329c /src/udev/scsi_id | |
parent | b5ce2feebc8bcc02e03661de9d49b3ea0cd064a4 (diff) | |
download | systemd-1001167ca5e4cfdc6230562e4fb9029e5f624d53.tar.gz |
udev: replace strtoul by safe_ato*
Diffstat (limited to 'src/udev/scsi_id')
-rw-r--r-- | src/udev/scsi_id/scsi_id.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c index 41f92b68be..943262d436 100644 --- a/src/udev/scsi_id/scsi_id.c +++ b/src/udev/scsi_id/scsi_id.c @@ -12,7 +12,6 @@ #include <stdarg.h> #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <sys/stat.h> #include <unistd.h> @@ -21,6 +20,7 @@ #include "extract-word.h" #include "fd-util.h" #include "fileio.h" +#include "parse-util.h" #include "scsi_id.h" #include "string-util.h" #include "strv.h" @@ -58,12 +58,10 @@ static char revision_str[16]; static char type_str[16]; static void set_type(const char *from, char *to, size_t len) { - int type_num; - char *eptr; + unsigned type_num; const char *type = "generic"; - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { + if (safe_atou_full(from, 16, &type_num) >= 0) { switch (type_num) { case 0: type = "disk"; |