Displaying 5 results from an estimated 5 matches for "valid_term".
2016 Dec 24
0
[PATCH] lib: Use a common function to validate strings.
...f --git a/src/appliance-kcmdline.c b/src/appliance-kcmdline.c
index 6771668..c5bc65f 100644
--- a/src/appliance-kcmdline.c
+++ b/src/appliance-kcmdline.c
@@ -36,23 +36,8 @@
* Check that the $TERM environment variable is reasonable before
* we pass it through to the appliance.
*/
-static bool
-valid_term (const char *term)
-{
- size_t len = strlen (term);
-
- if (len == 0 || len > 16)
- return false;
-
- while (len > 0) {
- char c = *term++;
- len--;
- if (!c_isalnum (c) && c != '-' && c != '_')
- return false;
- }
-
- return true;
-}
+#de...
2016 Dec 24
2
[PATCH] lib: Use a common function to validate strings.
As discussed in the thread on validating $TERM, it would be good to
have a common function to do this. This is such a function.
The main advantage is it includes unit tests which the previous
functions did not.
Rich.
2016 Dec 18
0
[PATCH 2/2] launch: Validate $TERM before passing it through to the kernel command line.
...uot;
#include "guestfs-internal.h"
#include "guestfs-internal-actions.h"
@@ -284,6 +286,28 @@ guestfs_impl_config (guestfs_h *g,
return 0;
}
+/**
+ * Check that the $TERM environment variable is reasonable before
+ * we pass it through to the appliance.
+ */
+static int
+valid_term (const char *term)
+{
+ size_t len = strlen (term);
+
+ if (len == 0 || len > 16)
+ return 0;
+
+ while (len > 0) {
+ char c = *term++;
+ len--;
+ if (!c_isalnum (c) && c != '-' && c != '_')
+ return 0;
+ }
+
+ return 1;
+}
+
#if defined(...
2016 Dec 18
3
[PATCH 1/2] launch: Rationalize how we construct the Linux kernel command line.
This is just code refactoring.
---
src/launch.c | 172 +++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 109 insertions(+), 63 deletions(-)
diff --git a/src/launch.c b/src/launch.c
index 46d7ab9..84d5e82 100644
--- a/src/launch.c
+++ b/src/launch.c
@@ -293,9 +293,7 @@ guestfs_impl_config (guestfs_h *g,
#endif
#if defined(__aarch64__)
-#define EARLYPRINTK "
2016 Dec 22
1
Re: [PATCH 2/2] launch: Validate $TERM before passing it through to the kernel command line.
...clude "guestfs-internal-actions.h"
> @@ -284,6 +286,28 @@ guestfs_impl_config (guestfs_h *g,
> return 0;
> }
>
> +/**
> + * Check that the $TERM environment variable is reasonable before
> + * we pass it through to the appliance.
> + */
> +static int
> +valid_term (const char *term)
I guess the return value can be bool.
> +{
> + size_t len = strlen (term);
> +
> + if (len == 0 || len > 16)
> + return 0;
> +
> + while (len > 0) {
> + char c = *term++;
> + len--;
> + if (!c_isalnum (c) && c != '-...