Prefer to use strlcpy instead of strcpy

This commit is contained in:
twinaphex 2016-11-26 17:11:30 +01:00
parent 490b3f5ed2
commit cd0bf8f31a
2 changed files with 5 additions and 2 deletions

View File

@ -20,6 +20,7 @@
#include <sys/mman.h>
#include <errno.h>
#include <compat/strl.h>
#include <rthreads/rthreads.h>
#include <string/stdstring.h>
@ -377,7 +378,7 @@ static void drm_format_name(const unsigned int fourcc, char *format_str)
for (i = 0; i < ARRAY_SIZE(format_info); i++)
{
if (format_info[i].format == fourcc)
strcpy(format_str, format_info[i].name);
strlcpy(format_str, format_info[i].name, sizeof(format_str));
}
}

View File

@ -25,6 +25,8 @@
#include <sys/un.h>
#include <poll.h>
#include <compat/strl.h>
#include <GL/osmesa.h>
#include "../../runloop.h"
@ -73,7 +75,7 @@ static void osmesa_fifo_open(gfx_ctx_osmesa_data_t *osmesa)
saun.sun_family = AF_UNIX;
strcpy(saun.sun_path, g_osmesa_fifo);
strlcpy(saun.sun_path, g_osmesa_fifo, sizeof(saun.sun_path));
unlink(g_osmesa_fifo);