summaryrefslogtreecommitdiff
path: root/usr.bin/learn/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-14 16:09:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-04-14 16:09:31 +0000
commit06403d071eac6fccf486e1b49c446ce03d4838d7 (patch)
treee9f6383e4b27dce6e7564c07a4e92982588ffcf6 /usr.bin/learn/lib
parent42914e66d165e809734fc1be654b16e52c16a5e3 (diff)
use correct string functions in example
Diffstat (limited to 'usr.bin/learn/lib')
-rw-r--r--usr.bin/learn/lib/editor/L44.1g10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/learn/lib/editor/L44.1g b/usr.bin/learn/lib/editor/L44.1g
index b0eb263675f..0ea3d7894c7 100644
--- a/usr.bin/learn/lib/editor/L44.1g
+++ b/usr.bin/learn/lib/editor/L44.1g
@@ -30,7 +30,7 @@ selunit()
if (strcmp(dobuff, "bye") == 0)
wrapup(0);
level = todo = dobuff;
- sprintf(s, "../L%s", dobuff);
+ snprintf(s, sizeof s, "../L%s", dobuff);
if (access(s, 04) == 0)
return;
printf("no such lesson\n");
@@ -39,7 +39,7 @@ selunit()
retry:
f=scrin;
if (f==NULL) {
- sprintf(fnam, "../L%s", level);
+ snprintf(fnam, sizeof fnam, "../L%s", level);
f = fopen(fnam, "r");
if (f==NULL) {
fprintf(stderr, "No script for lesson %s.\n", level);
@@ -76,7 +76,7 @@ retry:
}
if (best < 0 && nsave) {
nsave--;
- strcpy(level, saved);
+ strlcpy(level, saved, sizeof level);
goto retry;
}
if (best <0) {
@@ -87,10 +87,10 @@ retry:
todo = 0;
return;
}
- strcpy (dobuff, posslev[best]);
+ strlcpy(dobuff, posslev[best], sizeof dobuff);
if (alts>1) {
nsave=1;
- strcpy (saved, level);
+ strcpy(saved, level, sizeof saved);
}
todo = dobuff;
fclose(f);