Skip to content

Commit e13b9be

Browse files
committed
clients/upsstats.c: avoid unbounded strcpy(), especially for data coming from callers [#3249]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 50ade3a commit e13b9be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clients/upsstats.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static void do_ifeq(const char *s)
633633

634634
upsdebug_call_starting_for_str1(s);
635635

636-
strcpy(var, s);
636+
strncpy(var, s, sizeof(var));
637637

638638
nargs = breakargs(var, aa);
639639
if(nargs != 2) {
@@ -659,7 +659,7 @@ static void do_ifbetween(const char *s)
659659

660660
upsdebug_call_starting_for_str1(s);
661661

662-
strcpy(var, s);
662+
strncpy(var, s, sizeof(var));
663663

664664
nargs = breakargs(var, aa);
665665
if (nargs != 3) {

0 commit comments

Comments
 (0)