From 06403d071eac6fccf486e1b49c446ce03d4838d7 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Mon, 14 Apr 2003 16:09:31 +0000 Subject: use correct string functions in example --- usr.bin/learn/lib/editor/L44.1g | 10 +++++----- 1 file 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); -- cgit v1.2.3