mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +00:00
conf: lim2str(): Fix buffer overflow in local debug function
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
db3263c441
commit
63199d368f
1 file changed
+7
-7
+7
-7
@@ -254,21 +254,21 @@ char *rlim2str(int rlim)
|
||||
|
||||
char *lim2str(struct rlimit *rlim)
|
||||
{
|
||||
char tmp[10];
|
||||
char tmp[20];
|
||||
static char buf[42];
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
if (RLIM_INFINITY == rlim->rlim_cur)
|
||||
sprintf(tmp, "unlimited, ");
|
||||
snprintf(tmp, sizeof(tmp), "unlimited, ");
|
||||
else
|
||||
sprintf(tmp, "%llu, ", (unsigned long long)rlim->rlim_cur);
|
||||
strcat(buf, tmp);
|
||||
snprintf(tmp, sizeof(tmp), "%llu, ", (unsigned long long)rlim->rlim_cur);
|
||||
strlcat(buf, tmp, sizeof(buf));
|
||||
|
||||
if (RLIM_INFINITY == rlim->rlim_max)
|
||||
sprintf(tmp, "unlimited, ");
|
||||
snprintf(tmp, sizeof(tmp), "unlimited, ");
|
||||
else
|
||||
sprintf(tmp, "%llu, ", (unsigned long long)rlim->rlim_max);
|
||||
strcat(buf, tmp);
|
||||
snprintf(tmp, sizeof(tmp), "%llu, ", (unsigned long long)rlim->rlim_max);
|
||||
strlcat(buf, tmp, sizeof(buf));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user