Index: libroar/basic.c
===================================================================
--- libroar/basic.c	(revision 5109)
+++ libroar/basic.c	(revision 5114)
@@ -36,13 +36,13 @@
 #include "libroar.h"
 
-int roar_connect_raw (char * server) {
+int roar_connect_raw (const char * server) {
  return roar_connect_raw2(server, 0, 0);
 }
 
-int roar_connect_raw2 (char * server, int flags, uint_least32_t timeout) {
+int roar_connect_raw2 (const char * server, int flags, uint_least32_t timeout) {
 #ifdef ROAR_HAVE_LIBSLP
  struct roar_libroar_config * config = roar_libroar_get_config();
 #endif
- char user_sock[80];
+ char user_sock[128];
  char * roar_server;
  int i = 0;
@@ -50,5 +50,5 @@
  int fh = -1;
  int is_decnet = 0;
- char * obj = NULL;
+ const char * obj = NULL;
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
  struct passwd * pwd;
@@ -92,5 +92,5 @@
 
 #if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
- if ( server == NULL && (i = readlink("/etc/roarserver", user_sock, 79)) != -1 ) {
+ if ( server == NULL && (i = readlink("/etc/roarserver", user_sock, sizeof(user_sock)-1)) != -1 ) {
    user_sock[i] = 0;
    server = user_sock;
@@ -127,5 +127,6 @@
   }
 
-  snprintf(user_sock, 79, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER);
+  snprintf(user_sock, sizeof(user_sock)-1, "%s/%s", roar_server, ROAR_DEFAULT_SOCK_USER);
+  user_sock[sizeof(user_sock)-1] = 0;
 
   if ( (fh = roar_socket_connect(user_sock, 0)) != -1 )
@@ -189,15 +190,20 @@
   /* connect via (char*)server */
   // find a port:
-  if ( *server != '/' ) { // don't test AF_UNIX sockets for ports
-   for (i = 0; server[i] != 0; i++) {
-    if ( server[i] == ':' ) {
-     if ( server[i+1] == ':' ) { // DECnet, leave unchanged
+
+  strncat(user_sock, server, sizeof(user_sock)-1);
+  user_sock[sizeof(user_sock)-1] = 0;
+  server = user_sock;
+
+  if ( *user_sock != '/' ) { // don't test AF_UNIX sockets for ports
+   for (i = 0; user_sock[i] != 0; i++) {
+    if ( user_sock[i] == ':' ) {
+     if ( user_sock[i+1] == ':' ) { // DECnet, leave unchanged
       is_decnet = 1;
-      obj = &server[i+2];
+      obj = &user_sock[i+2];
       break;
      }
 
-     port = atoi(server+i+1);
-     server[i] = 0;
+     port = atoi(&(user_sock[i+1]));
+     user_sock[i] = 0;
      break;
     }
@@ -206,15 +212,14 @@
 
   if ( is_decnet ) {
-    *user_sock = 0;
-   if ( *server == ':' ) {
+   if ( *user_sock == ':' ) {
     if ( roar_socket_get_local_nodename() )
-     strncat(user_sock, roar_socket_get_local_nodename(), 6);
-   }
-
-   strncat(user_sock, server, 79);
-   server = user_sock;
+     roar_mm_strlcat(user_sock, roar_socket_get_local_nodename(), sizeof(user_sock)-1);
+     user_sock[sizeof(user_sock)-1] = 0;
+   }
+
    if ( *obj == 0 ) {
 #ifdef DN_MAXOBJL
-    strncat(user_sock, ROAR_DEFAULT_OBJECT, DN_MAXOBJL+2);
+    roar_mm_strlcat(user_sock, ROAR_DEFAULT_OBJECT, sizeof(user_sock)-1);
+    user_sock[sizeof(user_sock)-1] = 0;
 #else
     ROAR_ERR("roar_connect_raw2(*): size of DECnet object unknown.");
@@ -224,9 +229,9 @@
 
   if ( port || is_decnet ) {
-   fh = roar_socket_connect(server, port);
+   fh = roar_socket_connect(user_sock, port);
    // restore the original string
-   server[i] = ':';
+   user_sock[i] = ':';
   } else {
-   fh = roar_socket_connect(server, ROAR_DEFAULT_PORT);
+   fh = roar_socket_connect(user_sock, ROAR_DEFAULT_PORT);
   }
  }
@@ -240,9 +245,9 @@
 }
 
-int roar_connect    (struct roar_connection * con, char * server) {
+int roar_connect    (struct roar_connection * con, const char * server) {
  return roar_connect2(con, server, 0, 0);
 }
 
-int roar_connect2     (struct roar_connection * con, char * server, int flags, uint_least32_t timeout) {
+int roar_connect2     (struct roar_connection * con, const char * server, int flags, uint_least32_t timeout) {
  int fh;
 
@@ -381,5 +386,5 @@
 }
 
-int roar_identify   (struct roar_connection * con, char * name) {
+int roar_identify   (struct roar_connection * con, const char * name) {
  struct roar_message mes;
  pid_t pid;
@@ -403,5 +408,5 @@
  ROAR_DBG("roar_identify(*): name=%p", name);
 
- max_len = strlen(name);
+ max_len = roar_mm_strlen(name);
  ROAR_DBG("roar_identify(*): strlen(name) = %i", max_len);
 
