char *bstrncat(char *dest, const char *src, int maxlen)
{
- strncat(dest, src, maxlen-1);
+ int len = strlen(dest);
+ if (len < maxlen-1) {
+ strncpy(dest+len, src, maxlen-len-1);
+ }
dest[maxlen-1] = 0;
return dest;
}
char *bstrncat(char *dest, POOL_MEM &src, int maxlen)
{
- strncat(dest, src.c_str(), maxlen-1);
+
+ int len = strlen(dest);
+ if (len < maxlen-1) {
+ strncpy(dest+len, src.c_str(), maxlen-len-1);
+ }
dest[maxlen-1] = 0;
return dest;
}