Fix gcc sprintf warnings
Gcc 9 has become more vocal with sprintf buffer overflow checking. Remove these sprintf warnings by changing the offending calls to a snprintf wrapper that will explicitly check the result.
This commit is contained in:
@@ -1207,13 +1207,13 @@ struct permonst **for_supplement;
|
||||
|
||||
*firstmatch = look_buf;
|
||||
if (*(*firstmatch)) {
|
||||
Sprintf(temp_buf, " (%s)", *firstmatch);
|
||||
Snprintf(temp_buf, sizeof(temp_buf), " (%s)", *firstmatch);
|
||||
(void) strncat(out_str, temp_buf,
|
||||
BUFSZ - strlen(out_str) - 1);
|
||||
found = 1; /* we have something to look up */
|
||||
}
|
||||
if (monbuf[0]) {
|
||||
Sprintf(temp_buf, " [seen: %s]", monbuf);
|
||||
Snprintf(temp_buf, sizeof(temp_buf), " [seen: %s]", monbuf);
|
||||
(void) strncat(out_str, temp_buf,
|
||||
BUFSZ - strlen(out_str) - 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user