Skip to content

Commit

Permalink
#1855 Make sure the to_str is null terminated after strncpy
Browse files Browse the repository at this point in the history
  • Loading branch information
hsoh-u authored Sep 1, 2021
1 parent afe023e commit f4d647a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion met/src/basic/vx_util/string_fxns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ void m_strncpy(char *to_str, const char *from_str, const int buf_len,
to_str[str_len] = 0;
}
}
else strncpy(to_str, from_str, str_len);
else {
strncpy(to_str, from_str, str_len);
to_str[str_len] = 0;
}

if (strcmp(from_str, to_str)) {
mlog << Warning << "\n" << method_name
Expand Down

0 comments on commit f4d647a

Please sign in to comment.