summaryrefslogtreecommitdiff
path: root/choose.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-07-17 20:37:51 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2009-07-17 21:18:06 -0700
commit56a14b8a1f4d3aa883485b794c818581b8f07cd8 (patch)
tree2ce09753683336d48858a91851647aa4274a4aa5 /choose.c
parenta74131c41c63cbe5861b9550dfa7a921ec601c87 (diff)
sprintf -> snprintf/asprintf conversions
Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com>
Diffstat (limited to 'choose.c')
-rw-r--r--choose.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/choose.c b/choose.c
index f313d8c..e97e0d2 100644
--- a/choose.c
+++ b/choose.c
@@ -101,10 +101,14 @@ ARRAY8ToDottedDecimal (
char *buf,
int buflen)
{
- if (a->length != 4 || buflen < 20)
+ int outlen;
+ if (a->length != 4)
return 0;
- sprintf(buf, "%d.%d.%d.%d",
- a->data[0], a->data[1], a->data[2], a->data[3]);
+ outlen = snprintf(buf, buflen, "%d.%d.%d.%d",
+ a->data[0], a->data[1], a->data[2], a->data[3]);
+ if (outlen >= buflen) {
+ return 0;
+ }
return 1;
}
@@ -529,7 +533,7 @@ RunChooser (struct display *d)
strcpy (buf, "-clientaddress ");
if (FormatARRAY8 (&d->clientAddr, buf + strlen (buf), sizeof (buf) - strlen (buf)))
args = parseArgs (args, buf);
- sprintf (buf, "-connectionType %d", d->connectionType);
+ snprintf (buf, sizeof(buf), "-connectionType %d", d->connectionType);
args = parseArgs (args, buf);
ForEachChooserHost (&d->clientAddr, d->connectionType, AddChooserHost,
(char *) &args);