[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tyndur-devel] [PATCH] servmgr: RPC-Interface benutzbar machen



Antoine Kaufmann schrieb:
! libc: Der Servicename wird in servmgr_need jetzt nullterminiert
        versendet...
! servmgr: ... und servmgr prueft jetzt sogar das richtige Byte um zu
           pruefen ob die Daten nulltermiert sind. ;-)
---
 src/modules/lib/servmgr.c   |    4 ++--
 src/modules/servmgr/rpcif.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/modules/lib/servmgr.c b/src/modules/lib/servmgr.c
index 56fb700..47a295b 100644
--- a/src/modules/lib/servmgr.c
+++ b/src/modules/lib/servmgr.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 The tyndur Project. All rights reserved.
+ * Copyright (c) 2008-2009 The tyndur Project. All rights reserved.
  *
  * This code is derived from software contributed to the tyndur Project
  * by Antoine Kaufmann.
@@ -43,7 +43,7 @@ static pid_t servmgr_pid(void);
bool servmgr_need(const char* service_name)
 {
-    return rpc_get_dword(servmgr_pid(), "NEEDSERV", strlen(service_name),
+    return rpc_get_dword(servmgr_pid(), "NEEDSERV", strlen(service_name) + 1,
         (char*) service_name);
 }
diff --git a/src/modules/servmgr/rpcif.c b/src/modules/servmgr/rpcif.c
index eda7a48..66c1a66 100644
--- a/src/modules/servmgr/rpcif.c
+++ b/src/modules/servmgr/rpcif.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 The tyndur Project. All rights reserved.
+ * Copyright (c) 2008-2009 The tyndur Project. All rights reserved.
  *
  * This code is derived from software contributed to the tyndur Project
  * by Antoine Kaufmann.
@@ -58,7 +58,7 @@ static void rpc_needserv(pid_t pid, dword cid, size_t data_size, void* data)
     bool result;
// Pruefen ob der Name nullterminiert ist
-    if (name[data_size] != 0) {
+    if (name[data_size - 1] != 0) {

Underflows sind auch nicht viel besser als Overflows. ;-) Also lieber (data_size > 0) && (name[data_size - 1] != 0)

Ansonsten kann das rein.