argl... fixed overflow when appending the '/'
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 1 Feb 2005 00:55:51 +0000 (00:55 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 1 Feb 2005 00:55:51 +0000 (00:55 +0000)
git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@1837 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/lib/createskeleton-full.hc

index 8090a93..d1a0793 100644 (file)
 #define CONCAT_TWO_ARGS(BUF, LHS,RHS)                  \
   size_t               BUF ## l1 = strlen(LHS);        \
   size_t               BUF ## l2 = strlen(RHS);        \
-  char                 BUF[BUF ## l1 + BUF ## l2 + 2]; \
+  char                 BUF[BUF##l1 + BUF##l2 + 2];     \
                                                        \
-  memcpy(BUF,      LHS, BUF ## l1 + 1);                        \
-  if (BUF ## l2>0) {                                   \
-    memcpy(BUF+BUF ## l1,   "/", BUF ## l1);           \
-    memcpy(BUF+BUF ## l1+1, RHS, BUF ## l2+1);         \
+  memcpy(BUF,      LHS, BUF##l1 + 1);                  \
+  if (BUF##l2 > 0) {                                   \
+    BUF[ BUF##l1 ] = '/';                              \
+    memcpy(BUF+ BUF##l1 + 1, RHS, BUF##l2 + 1);                \
   }
 
 static inline int