]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
ipcs: do not use atoi()
authorKarel Zak <kzak@redhat.com>
Tue, 22 Jun 2021 13:19:22 +0000 (15:19 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 22 Jun 2021 15:04:24 +0000 (17:04 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/ipcs.c

index 6730272221c23ef487cfd655bb180a504f920bab..9380d984be461a026cd4d18b03e66a12c11c6562 100644 (file)
@@ -22,6 +22,7 @@
 #include "nls.h"
 #include "closestream.h"
 #include "timeutils.h"
+#include "strutils.h"
 
 #include "ipcutils.h"
 
@@ -120,7 +121,7 @@ int main (int argc, char **argv)
        while ((opt = getopt_long(argc, argv, options, longopts, NULL)) != -1) {
                switch (opt) {
                case 'i':
-                       id = atoi (optarg);
+                       id = strtos32_or_err(optarg, _("failed to parse id argument"));
                        specific = 1;
                        break;
                case 'a':