[PATCH obexd] Fix missing Name header check in FTP action code

Subsystems: the rest

STALE5524d

2 messages, 2 authors, 2011-08-09 · open the first message on its own page

[PATCH obexd] Fix missing Name header check in FTP action code

From: Slawomir Bochenski <hidden>
Date: 2011-08-09 08:44:39

---
 plugins/ftp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/plugins/ftp.c b/plugins/ftp.c
index 57fd23b..8705975 100644
--- a/plugins/ftp.c
+++ b/plugins/ftp.c
@@ -541,6 +541,10 @@ int ftp_action(struct obex_session *os, obex_object_t *obj, void *user_data)
 	uint8_t action_id;
 
 	name = obex_get_name(os);
+
+	if (name == NULL || !is_filename(name))
+		return -EBADR;
+
 	destname = obex_get_destname(os);
 	action_id = obex_get_action_id(os);
 
-- 
1.7.4.1

Re: [PATCH obexd] Fix missing Name header check in FTP action code

From: Johan Hedberg <hidden>
Date: 2011-08-09 10:00:37

Hi Slawek,

On Tue, Aug 09, 2011, Slawomir Bochenski wrote:
---
 plugins/ftp.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Applied, but with a minor coding-style modification:
 	name = obex_get_name(os);
+
+	if (name == NULL || !is_filename(name))
+		return -EBADR;
Usually when we have an assignment to a variable and then an immediately
following check for the variable there's no empty line between the
assignment and the if-statement, so I removed this empty line.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help