summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--psgeom.c38
-rw-r--r--xkbprint.c10
2 files changed, 26 insertions, 22 deletions
diff --git a/psgeom.c b/psgeom.c
index 94c178a..e984e6c 100644
--- a/psgeom.c
+++ b/psgeom.c
@@ -852,11 +852,13 @@ PSPageTrailer(FILE *out, PSState *state)
Atom sAtom;
if (state->args->nLabelGroups == 1)
- sprintf(buf, "Group %d", state->args->baseLabelGroup + 1);
+ snprintf(buf, sizeof(buf), "Group %d",
+ state->args->baseLabelGroup + 1);
else
- sprintf(buf, "Groups %d-%d", state->args->baseLabelGroup + 1,
- state->args->baseLabelGroup +
- state->args->nLabelGroups);
+ snprintf(buf, sizeof(buf), "Groups %d-%d",
+ state->args->baseLabelGroup + 1,
+ state->args->baseLabelGroup +
+ state->args->nLabelGroups);
fprintf(out, "kbx kbdscalewidth 0 (%s) centeroffset pop add\n",
buf);
fprintf(out, " kby kbdscaleheight add %d add\n", baseline);
@@ -933,11 +935,13 @@ PSPageTrailer(FILE *out, PSState *state)
PSSetColor(out, state, state->black);
PSSetFont(out, state, FONT_LATIN1, 14, False);
if (state->args->nLabelGroups == 1)
- sprintf(buf, "Group %d", state->args->baseLabelGroup + 1);
+ snprintf(buf, sizeof(buf), "Group %d",
+ state->args->baseLabelGroup + 1);
else
- sprintf(buf, "Groups %d-%d", state->args->baseLabelGroup + 1,
- state->args->baseLabelGroup +
- state->args->nLabelGroups + 1);
+ snprintf(buf, sizeof(buf), "Groups %d-%d",
+ state->args->baseLabelGroup + 1,
+ state->args->baseLabelGroup +
+ state->args->nLabelGroups + 1);
fprintf(out, "kbx kbdscalewidth 0 (%s) centeroffset pop add\n",
buf);
fprintf(out, " kby kbdscaleheight add %d add\n", baseline);
@@ -1656,13 +1660,13 @@ FindKeysymsByName(XkbDescPtr xkb, char *name, PSState *state, KeyTop *top)
}
else if (((sym & (~0xff)) == 0) && isprint(sym) && (!isspace(sym))) {
if (sym == '(')
- sprintf((char *) buf, "\\(");
+ snprintf((char *) buf, sizeof(buf), "\\(");
else if (sym == ')')
- sprintf((char *) buf, "\\)");
+ snprintf((char *) buf, sizeof(buf), "\\)");
else if (sym == '\\')
- sprintf((char *) buf, "\\\\");
+ snprintf((char *) buf, sizeof(buf), "\\\\");
else
- sprintf((char *) buf, "%c", (char) sym);
+ snprintf((char *) buf, sizeof(buf), "%c", (char) sym);
top->font[(g * 2) + l] = FONT_LATIN1;
top->size[(g * 2) + l] = SZ_MEDIUM;
switch (buf[0]) {
@@ -1703,7 +1707,7 @@ FindKeysymsByName(XkbDescPtr xkb, char *name, PSState *state, KeyTop *top)
if (tmp != NULL)
strcpy((char *) buf, tmp);
else
- sprintf((char *) buf, "(%ld)", sym);
+ snprintf((char *) buf, sizeof(buf), "(%ld)", sym);
top->font[(g * 2) + l] = FONT_LATIN1;
if (strlen((char *) buf) < 9)
top->size[(g * 2) + l] = SZ_SMALL;
@@ -1878,7 +1882,7 @@ PSLabelKey(FILE *out, PSState *state, KeyTop *top, int x, int y,
}
}
if (state->args->wantKeycodes) {
- sprintf(keycode, "%d", kc);
+ snprintf(keycode, sizeof(keycode), "%d", kc);
PSSetFont(out, state, FONT_LATIN1, 8, True);
PSDrawLabel(out, keycode, x + bounds->x1, y + btm - 5, w, 0);
}
@@ -2008,12 +2012,12 @@ PSSection(FILE *out, PSState *state, XkbSectionPtr section)
}
else if (state->args->label == LABEL_KEYCODE) {
name = buf;
- sprintf(name, "%d",
+ snprintf(name, sizeof(buf), "%d",
XkbFindKeycodeByName(xkb, key->name.name, True));
if (olKey) {
name2 = buf2;
- sprintf(name, "%d",
- XkbFindKeycodeByName(xkb, olKey, True));
+ snprintf(name2, sizeof(buf2), "%d",
+ XkbFindKeycodeByName(xkb, olKey, True));
}
}
bzero(&top, sizeof(KeyTop));
diff --git a/xkbprint.c b/xkbprint.c
index fe2219d..1dd68dd 100644
--- a/xkbprint.c
+++ b/xkbprint.c
@@ -498,9 +498,9 @@ parseArgs(int argc, char *argv[])
exit(1);
}
if (args.wantEPS)
- sprintf(outputFile, "stdin.eps");
+ snprintf(outputFile, len, "stdin.eps");
else
- sprintf(outputFile, "stdin.ps");
+ snprintf(outputFile, len, "stdin.ps");
}
else if ((outputFile == NULL) && (inputFile != NULL)) {
size_t len;
@@ -523,9 +523,9 @@ parseArgs(int argc, char *argv[])
ext = strrchr(base, '.');
if (ext == NULL) {
if (args.wantEPS)
- sprintf(outputFile, "%s.eps", base);
+ snprintf(outputFile, len, "%s.eps", base);
else
- sprintf(outputFile, "%s.ps", base);
+ snprintf(outputFile, len, "%s.ps", base);
}
else {
strcpy(outputFile, base);
@@ -540,7 +540,7 @@ parseArgs(int argc, char *argv[])
char *ch, *name, buf[128];
if (inDpyName[0] == ':')
- sprintf(name = buf, "server%s", inDpyName);
+ snprintf(name = buf, sizeof(buf), "server%s", inDpyName);
else
name = inDpyName;