aboutsummaryrefslogtreecommitdiff
path: root/include/libssh
diff options
context:
space:
mode:
authorAnderson Toshiyuki Sasaki <ansasaki@redhat.com>2019-10-22 16:08:24 +0200
committerAndreas Schneider <asn@cryptomilk.org>2019-12-09 16:08:03 +0100
commitc4ad1aba9860e02fe03ef3f58a047964e9e765fc (patch)
treefb0e7b62525033e24e63818840b0d5a27b7eff5e /include/libssh
parentc75d417d06867fd792b788e6281334621c2cd335 (diff)
downloadlibssh-c4ad1aba9860e02fe03ef3f58a047964e9e765fc.tar.gz
libssh-c4ad1aba9860e02fe03ef3f58a047964e9e765fc.tar.xz
libssh-c4ad1aba9860e02fe03ef3f58a047964e9e765fc.zip
CVE-2019-14889: misc: Add function to quote file names
The added function quote file names strings to be used in a shell. Special cases are treated for the charactes '\'' and '!'. Fixes T181 Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'include/libssh')
-rw-r--r--include/libssh/misc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/libssh/misc.h b/include/libssh/misc.h
index 543de04f..4f0b9439 100644
--- a/include/libssh/misc.h
+++ b/include/libssh/misc.h
@@ -51,6 +51,12 @@ struct ssh_timestamp {
long useconds;
};
+enum ssh_quote_state_e {
+ NO_QUOTE,
+ SINGLE_QUOTE,
+ DOUBLE_QUOTE
+};
+
struct ssh_list *ssh_list_new(void);
void ssh_list_free(struct ssh_list *list);
struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list);
@@ -88,4 +94,6 @@ void ssh_log_hexdump(const char *descr, const unsigned char *what, size_t len);
int ssh_mkdirs(const char *pathname, mode_t mode);
+int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len);
+
#endif /* MISC_H_ */