1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

use strlcat

* addr2line.c (follow_debuglink): use strlcat instead of strncat.

* dln.c (aix_loaderror): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-02-27 07:10:13 +00:00
parent 6245e02cd3
commit 057098bfdc
2 changed files with 3 additions and 5 deletions

View file

@ -444,10 +444,8 @@ follow_debuglink(char *debuglink, int num_traces, void **traces, char **syms,
subdir = (char *)alloca(strlen(binary_filename) + 1); subdir = (char *)alloca(strlen(binary_filename) + 1);
strcpy(subdir, binary_filename); strcpy(subdir, binary_filename);
strcpy(binary_filename, global_debug_dir); strcpy(binary_filename, global_debug_dir);
strncat(binary_filename, subdir, strlcat(binary_filename, subdir, PATH_MAX);
PATH_MAX - strlen(binary_filename) - 1); strlcat(binary_filename, debuglink, PATH_MAX);
strncat(binary_filename, debuglink,
PATH_MAX - strlen(binary_filename) - 1);
munmap(current_line->mapped, current_line->mapped_size); munmap(current_line->mapped, current_line->mapped_size);
close(current_line->fd); close(current_line->fd);

2
dln.c
View file

@ -1180,7 +1180,7 @@ aix_loaderror(const char *pathname)
{ {
char *message[1024], errbuf[1024]; char *message[1024], errbuf[1024];
int i; int i;
#define ERRBUF_APPEND(s) strncat(errbuf, (s), sizeof(errbuf)-strlen(errbuf)-1) #define ERRBUF_APPEND(s) strlcat(errbuf, (s), sizeof(errbuf))
snprintf(errbuf, sizeof(errbuf), "load failed - %s. ", pathname); snprintf(errbuf, sizeof(errbuf), "load failed - %s. ", pathname);
if (loadquery(L_GETMESSAGES, &message[0], sizeof(message)) != -1) { if (loadquery(L_GETMESSAGES, &message[0], sizeof(message)) != -1) {