author | erik <erik> | 2007-01-24 23:29:42 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-24 23:29:42 (UTC) |
commit | 0076a11b467dce1233194ce228287a2a127b1f5d (patch) (unidiff) | |
tree | f2136a1a3e9b5fd6bede52251ed7249365838752 /noncore/games/kbill | |
parent | 48d9219a96096cf44df8ac24413b36d1b718b1d5 (diff) | |
download | opie-0076a11b467dce1233194ce228287a2a127b1f5d.zip opie-0076a11b467dce1233194ce228287a2a127b1f5d.tar.gz opie-0076a11b467dce1233194ce228287a2a127b1f5d.tar.bz2 |
Each file in this commit has the issue where it is possible for code to
overrun static buffers. This could lead to serious problems. Granted it
is almost impossible to do that. But it isn't totally impossible. So this
commit makes it impossible to overrun.
-rw-r--r-- | noncore/games/kbill/UI.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp index 611cebf..a49c3c1 100644 --- a/noncore/games/kbill/UI.cpp +++ b/noncore/games/kbill/UI.cpp | |||
@@ -73,5 +73,5 @@ void UI::popup_dialog (int dialog) { | |||
73 | case Game::HIGHSCORE: | 73 | case Game::HIGHSCORE: |
74 | //QMessageBox::message(("HighScore"), highscorestr); | ||
75 | break; | 74 | break; |
76 | case Game::ENTERNAME: { | 75 | case Game::ENTERNAME: |
76 | { | ||
77 | InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); | 77 | InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); |
@@ -79,3 +79,3 @@ void UI::popup_dialog (int dialog) { | |||
79 | char str[20], *nl; | 79 | char str[20], *nl; |
80 | strcpy(str, b.getText()); | 80 | strncpy(str, b.getText(), 19); |
81 | if (!str[0] || state) | 81 | if (!str[0] || state) |
@@ -84,5 +84,4 @@ void UI::popup_dialog (int dialog) { | |||
84 | *nl = '\0'; | 84 | *nl = '\0'; |
85 | if (strlen(str) > 20) | 85 | if (strlen(str) > 19) |
86 | str[20] = 0; /* truncate string if too long */ | 86 | str[19] = '\0'; /* truncate/terminate the string if it is too long */ |
87 | // scores.recalc(str); | ||
88 | } | 87 | } |