summaryrefslogtreecommitdiff
path: root/src/basic/string-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/string-util.c')
-rw-r--r--src/basic/string-util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index a7cf4e8520..a1781c505a 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -765,3 +765,20 @@ char *string_free_erase(char *s) {
string_erase(s);
return mfree(s);
}
+
+bool string_is_safe(const char *p) {
+ const char *t;
+
+ if (!p)
+ return false;
+
+ for (t = p; *t; t++) {
+ if (*t > 0 && *t < ' ') /* no control characters */
+ return false;
+
+ if (strchr(QUOTES "\\\x7f", *t))
+ return false;
+ }
+
+ return true;
+}