Skip to content

Commit

Permalink
Replace remaining strcats with strlcat
Browse files Browse the repository at this point in the history
  • Loading branch information
Twinaphex committed May 22, 2012
1 parent 3e10f61 commit 69209b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions console/rzlib/rzlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,8 @@ const char* gzerror (voidp file, int *errnum)
free(s->msg);
s->msg = (char*)malloc(strlen(s->path) + strlen(m) + 3);
strlcpy(s->msg, s->path, sizeof(s->msg));
strcat(s->msg, ": ");
strcat(s->msg, m);
strlcat(s->msg, ": ", sizeof(s->msg));
strlcat(s->msg, m, sizeof(s->msg));
return (const char*)s->msg;
}

Expand Down
11 changes: 6 additions & 5 deletions xenon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <xenon_soc/xenon_power.h>
#include <elf/elf.h>
#include <dirent.h>
#include "../compat/strl.h"

#undef main

Expand Down Expand Up @@ -100,8 +101,8 @@ static void append_dir_to_path(char *path, const char *dir)
return;
else
{
strcat(path, dir);
strcat(path, "/");
strlcat(path, dir, sizeof(path));
strlcat(path, "/", sizeof(path));
}
}

Expand All @@ -128,7 +129,7 @@ int main(void)
return 0;

strlcpy(path, s, sizeof(path));
strcat(path, ":/");
strlcat(path, ":/", sizeof(path));

load_dir(path);

Expand Down Expand Up @@ -164,7 +165,7 @@ int main(void)
{
char fn[256];
strlcpy(fn, path, sizeof(fn));
strcat(fn, entries[pos].d_name);
strlcat(fn, entries[pos].d_name, sizeof(fn));

printf("%s\n", fn);

Expand All @@ -188,7 +189,7 @@ int main(void)
} while (handle < 0);

strlcpy(path, s, sizeof(path));
strcat(path, ":/");
strlcat(path, ":/", sizeof(path));
load_dir(path);
ppos = -1;
pos = 0;
Expand Down

0 comments on commit 69209b5

Please sign in to comment.