]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/commitdiff
misc-progs: Remove own copy of strlcat.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2013 16:23:40 +0000 (18:23 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 12 Oct 2013 16:23:40 +0000 (18:23 +0200)
Add compatibility define that uses strncat.

src/misc-progs/setuid.c
src/misc-progs/setuid.h

index 9e5a8f54effff0b0aa11a9e17c0c0c06491479cc..b1e124cbc56be161095931bcfa96ed89d05bc33c 100644 (file)
@@ -115,27 +115,6 @@ int system_core(char* command, uid_t uid, gid_t gid, char *error)
 \r
 }\r
 \r
 \r
 }\r
 \r
-/* BSD style safe strcat; from the secure programming cookbook */\r
-size_t strlcat(char *dst, const char *src, size_t len) {\r
-       char       *dstptr = dst;\r
-       size_t     dstlen, tocopy = len;\r
-       const char *srcptr = src;\r
-\r
-       while (tocopy-- && *dstptr) dstptr++;\r
-       dstlen = dstptr - dst;\r
-       if (!(tocopy = len - dstlen)) return (dstlen + strlen(src));\r
-       while (*srcptr) {\r
-               if (tocopy != 1) {\r
-                       *dstptr++ = *srcptr;\r
-                       tocopy--;\r
-               }\r
-               srcptr++;\r
-       }\r
-       *dstptr = 0;\r
-\r
-       return (dstlen + (srcptr - src));\r
-}\r
-\r
 /* General routine to initialise a setuid root program, and put the\r
  * environment in a known state. Returns 1 on success, if initsetuid() returns\r
  * 0 then you should exit(1) immediately, DON'T attempt to recover from the\r
 /* General routine to initialise a setuid root program, and put the\r
  * environment in a known state. Returns 1 on success, if initsetuid() returns\r
  * 0 then you should exit(1) immediately, DON'T attempt to recover from the\r
index d1155c5e8dedac0f426808888941136281f9fc6d..9df32066a1d166751308bf458eb9fd73cef57bc9 100644 (file)
@@ -23,7 +23,10 @@ extern char * trusted_env[4];
 int system_core(char* command, uid_t uid, gid_t gid, char *error);
 int safe_system(char* command);
 int unpriv_system(char* command, uid_t uid, gid_t gid);
 int system_core(char* command, uid_t uid, gid_t gid, char *error);
 int safe_system(char* command);
 int unpriv_system(char* command, uid_t uid, gid_t gid);
-size_t strlcat(char *dst, const char *src, size_t len);
 int initsetuid(void);
 
 int initsetuid(void);
 
+/* Compatibility for the local copy of strlcat,
+ * which has been removed. */
+#define strlcat(src, dst, size) strncat(src, dst, size)
+
 #endif
 #endif