diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-07-14 07:22:30 +0000 |
commit | 59d780973e0c1aab681be9dcba1baa2706caf92f (patch) | |
tree | 069cf4d5aa497e953fd1467abefc88134b3fc727 /apps/app_getcpeid.c | |
parent | 8e06b188edfed3926b0e640a2294525b3488ccdf (diff) |
Merge rgagnon's pedantic string checks (apps a-m, bug #2035)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3428 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_getcpeid.c')
-rwxr-xr-x | apps/app_getcpeid.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index 9aa0bc60b..d0a0be6bc 100755 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -67,9 +67,9 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) stuff[2] = data[2]; stuff[3] = data[3]; memset(data, 0, sizeof(data)); - strcpy(stuff[0], "** CPE Info **"); - strcpy(stuff[1], "Identifying CPE..."); - strcpy(stuff[2], "Please wait..."); + strncpy(stuff[0], "** CPE Info **", sizeof(data[0]) - 1); + strncpy(stuff[1], "Identifying CPE...", sizeof(data[1]) - 1); + strncpy(stuff[2], "Please wait...", sizeof(data[2]) - 1); res = adsi_load_session(chan, NULL, 0, 1); if (res > 0) { cpeid_setstatus(chan, stuff, 0); @@ -80,8 +80,8 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) ast_verbose(VERBOSE_PREFIX_3 "Got CPEID of '%02x:%02x:%02x:%02x' on '%s'\n", cpeid[0], cpeid[1], cpeid[2], cpeid[3], chan->name); } if (res > -1) { - strcpy(stuff[1], "Measuring CPE..."); - strcpy(stuff[2], "Please wait..."); + strncpy(stuff[1], "Measuring CPE...", sizeof(data[1]) - 1); + strncpy(stuff[2], "Please wait...", sizeof(data[2]) - 1); cpeid_setstatus(chan, stuff, 0); res = adsi_get_cpeinfo(chan, &width, &height, &buttons, 0); if (res > -1) { @@ -92,14 +92,14 @@ static int cpeid_exec(struct ast_channel *chan, void *idata) } if (res > -1) { if (gotcpeid) - sprintf(stuff[1], "CPEID: %02x:%02x:%02x:%02x", cpeid[0], cpeid[1], cpeid[2], cpeid[3]); + snprintf(stuff[1], sizeof(data[1]), "CPEID: %02x:%02x:%02x:%02x", cpeid[0], cpeid[1], cpeid[2], cpeid[3]); else - strcpy(stuff[1], "CPEID Unknown"); + strncpy(stuff[1], "CPEID Unknown", sizeof(data[1]) - 1); if (gotgeometry) - sprintf(stuff[2], "Geom: %dx%d, %d buttons", width, height, buttons); + snprintf(stuff[2], sizeof(data[2]), "Geom: %dx%d, %d buttons", width, height, buttons); else - strcpy(stuff[2], "Geometry unknown"); - strcpy(stuff[3], "Press # to exit"); + strncpy(stuff[2], "Geometry unknown", sizeof(data[2]) - 1); + strncpy(stuff[3], "Press # to exit", sizeof(data[3]) - 1); cpeid_setstatus(chan, stuff, 1); for(;;) { res = ast_waitfordigit(chan, 1000); |