Ticket #7000: libs_libmythui-string-overflow

File libs_libmythui-string-overflow, 675 bytes (added by Erik Hovland <erik@…>, 11 years ago)

Prevent a string overflow by using strncpy

Line 
1Use strncpy instead of strcpy
2
3From: Erik Hovland <erik@hovland.org>
4
5
6---
7
8 mythtv/libs/libmythui/lirc_client.c |    2 +-
9 1 files changed, 1 insertions(+), 1 deletions(-)
10
11
12diff --git a/mythtv/libs/libmythui/lirc_client.c b/mythtv/libs/libmythui/lirc_client.c
13index 4667b6c..866b144 100644
14--- a/mythtv/libs/libmythui/lirc_client.c
15+++ b/mythtv/libs/libmythui/lirc_client.c
16@@ -182,7 +182,7 @@ struct lirc_state *lirc_init(const char *lircrc_root_file,
17        if (lircd)
18        {
19                addr.sun_family=AF_UNIX;
20-               strcpy(addr.sun_path,lircd);
21+               strncpy(addr.sun_path,lircd,sizeof(addr.sun_path)-1);
22                state->lirc_lircd=socket(AF_UNIX,SOCK_STREAM,0);
23                if(state->lirc_lircd==-1)
24                {