am 8d57b79c: am bf66e448: am a1551e9b: Merge "Fix buffer overflow in syren utility"
* commit '8d57b79c26c9618ec50d3ee304e9abba41bfe4c9':
Fix buffer overflow in syren utility
diff --git a/toolbox/syren.c b/toolbox/syren.c
index 06e329e..47c2460 100644
--- a/toolbox/syren.c
+++ b/toolbox/syren.c
@@ -123,7 +123,11 @@
r = find_reg(argv[2]);
if (r == NULL) {
- strcpy(name, argv[2]);
+ if(strlen(argv[2]) >= sizeof(name)){
+ fprintf(stderr, "REGNAME too long\n");
+ return 0;
+ }
+ strlcpy(name, argv[2], sizeof(name));
char *addr_str = strchr(argv[2], ':');
if (addr_str == NULL)
return usage();
@@ -131,7 +135,7 @@
sio.page = strtoul(argv[2], 0, 0);
sio.addr = strtoul(addr_str, 0, 0);
} else {
- strcpy(name, r->name);
+ strlcpy(name, r->name, sizeof(name));
sio.page = r->page;
sio.addr = r->addr;
}