提交 2134a2d7 编写于 作者: H Heikki Linnakangas

Fix buffer overflow if a log filename is unexpectedly long.

Per Coverity.
上级 66d24db2
......@@ -631,7 +631,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
}
/* extract timestamp portion of filename */
strcpy(timestampbuf, de->d_name + 5);
snprintf(timestampbuf, sizeof(timestampbuf), "%s", de->d_name + 5);
timestampbuf[end] = '\0';
}
else
......@@ -646,7 +646,7 @@ pg_logdir_ls(PG_FUNCTION_ARGS)
continue;
/* extract timestamp portion of filename */
strcpy(timestampbuf, de->d_name + 11);
snprintf(timestampbuf, sizeof(timestampbuf), "%s", de->d_name + 11);
timestampbuf[17] = '\0';
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册