mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-12-17 10:23:21 +00:00
improve uint error handling to prevent crashes
This commit is contained in:
parent
efde7ce68e
commit
eadf4ec650
@ -1,9 +1,11 @@
|
|||||||
From ba4bc854ec0e39030cde295e5019e56f598472b2 Mon Sep 17 00:00:00 2001
|
From fbaf5f3b5d57c9239ed822d307f7f0b71aa53b27 Mon Sep 17 00:00:00 2001
|
||||||
From: Zuki Air <zukirust@gmail.com>
|
From: Zuki Air <zukirust@gmail.com>
|
||||||
Date: Sun, 27 Jul 2025 11:30:32 +0100
|
Date: Sun, 27 Jul 2025 11:30:32 +0100
|
||||||
Subject: [PATCH] river-ctl patch
|
Subject: [PATCH] river-ctl patch
|
||||||
|
|
||||||
remove func argument and use the root argument instead
|
remove func argument and use the root argument instead
|
||||||
|
|
||||||
|
improve uint error handling
|
||||||
---
|
---
|
||||||
.gitignore | 1 +
|
.gitignore | 1 +
|
||||||
Makefile | 22 +-
|
Makefile | 22 +-
|
||||||
@ -11,8 +13,8 @@ remove func argument and use the root argument instead
|
|||||||
dwl.c | 20 +-
|
dwl.c | 20 +-
|
||||||
dwlctl.c | 132 +++++
|
dwlctl.c | 132 +++++
|
||||||
protocols/river-control-unstable-v1.xml | 85 +++
|
protocols/river-control-unstable-v1.xml | 85 +++
|
||||||
river-control.h | 715 ++++++++++++++++++++++++
|
river-control.h | 722 ++++++++++++++++++++++++
|
||||||
7 files changed, 994 insertions(+), 15 deletions(-)
|
7 files changed, 1001 insertions(+), 15 deletions(-)
|
||||||
create mode 100644 dwlctl.c
|
create mode 100644 dwlctl.c
|
||||||
create mode 100644 protocols/river-control-unstable-v1.xml
|
create mode 100644 protocols/river-control-unstable-v1.xml
|
||||||
create mode 100644 river-control.h
|
create mode 100644 river-control.h
|
||||||
@ -437,10 +439,10 @@ index 0000000..aa5fc4d
|
|||||||
+</protocol>
|
+</protocol>
|
||||||
diff --git a/river-control.h b/river-control.h
|
diff --git a/river-control.h b/river-control.h
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..297a47e
|
index 0000000..237a926
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/river-control.h
|
+++ b/river-control.h
|
||||||
@@ -0,0 +1,715 @@
|
@@ -0,0 +1,722 @@
|
||||||
+#include "river-control-unstable-v1-private-protocol.c"
|
+#include "river-control-unstable-v1-private-protocol.c"
|
||||||
+#include "river-control-unstable-v1-protocol.h"
|
+#include "river-control-unstable-v1-protocol.h"
|
||||||
+#ifdef KEYS_USED
|
+#ifdef KEYS_USED
|
||||||
@ -618,6 +620,7 @@ index 0000000..297a47e
|
|||||||
+const char *zriver_error_no_matching_argument = "no matching argument";
|
+const char *zriver_error_no_matching_argument = "no matching argument";
|
||||||
+const char *zriver_error_double_appid = "set appid more then once!";
|
+const char *zriver_error_double_appid = "set appid more then once!";
|
||||||
+const char *zriver_error_double_title = "set title more then once!";
|
+const char *zriver_error_double_title = "set title more then once!";
|
||||||
|
+const char *zriver_error_under_zero = "argument needs to be more then zero!";
|
||||||
+#define STR_LINK_ARRAY_SIZE 10
|
+#define STR_LINK_ARRAY_SIZE 10
|
||||||
+struct Str_link {
|
+struct Str_link {
|
||||||
+ struct wl_list link;
|
+ struct wl_list link;
|
||||||
@ -998,7 +1001,13 @@ index 0000000..297a47e
|
|||||||
+ break;
|
+ break;
|
||||||
+ case(FUNC_STR_ARG_TYPE_UINT):
|
+ case(FUNC_STR_ARG_TYPE_UINT):
|
||||||
+ // TODO make overflow check
|
+ // TODO make overflow check
|
||||||
+ arg->ui = strtol(argument,NULL,10);
|
+ arg->i = strtol(argument,NULL,10);
|
||||||
|
+ if (arg->i > 0) {
|
||||||
|
+ arg->ui = arg->i;
|
||||||
|
+ } else {
|
||||||
|
+ args->error = true;
|
||||||
|
+ args->error_msg = zriver_error_under_zero;
|
||||||
|
+ }
|
||||||
+ break;
|
+ break;
|
||||||
+ case(FUNC_STR_ARG_TYPE_INT):
|
+ case(FUNC_STR_ARG_TYPE_INT):
|
||||||
+ arg->i = strtol(argument,NULL,10);
|
+ arg->i = strtol(argument,NULL,10);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user