From 43da185d5dcf17cf4768d5b39cfb277394fb7394 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 19 Sep 2015 03:50:35 +0200 Subject: [PATCH] Replace more usage of strcpy --- general.h | 2 +- gfx/d3d/render_chain_cg.cpp | 8 ++++++-- libretro-common/net/net_http.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/general.h b/general.h index f8fe0f669a..c6f546425f 100644 --- a/general.h +++ b/general.h @@ -158,7 +158,7 @@ static INLINE void rarch_fail(int error_code, const char *error) * just exit right away. */ rarch_assert(global->inited.error); - strcpy(global->error_string, error); + strlcpy(global->error_string, error, sizeof(global->error_string)); longjmp(global->error_sjlj_context, error_code); } diff --git a/gfx/d3d/render_chain_cg.cpp b/gfx/d3d/render_chain_cg.cpp index cd9f992774..502f94a55e 100644 --- a/gfx/d3d/render_chain_cg.cpp +++ b/gfx/d3d/render_chain_cg.cpp @@ -18,9 +18,13 @@ #include #include #include -#include + #include #include + +#include +#include + #include "render_chain_driver.h" #include "../video_driver.h" #include "../../general.h" @@ -1166,7 +1170,7 @@ static bool cg_d3d9_renderchain_add_lut(void *data, info.tex = lut; info.smooth = smooth; - strcpy(info.id, id); + strlcpy(info.id, id, sizeof(info.id)); if (!lut) return false; diff --git a/libretro-common/net/net_http.c b/libretro-common/net/net_http.c index 7e85624b2c..2414a2688b 100644 --- a/libretro-common/net/net_http.c +++ b/libretro-common/net/net_http.c @@ -175,7 +175,7 @@ struct http_connection_t *net_http_connection_new(const char *url) if (!conn->urlcopy) goto error; - strcpy(conn->urlcopy, url); + strlcpy(conn->urlcopy, url, sizeof(conn->urlcopy)); if (strncmp(url, "http://", strlen("http://")) != 0) goto error;