summaryrefslogtreecommitdiff
path: root/noncore
authorerik <erik>2007-01-24 23:29:42 (UTC)
committer erik <erik>2007-01-24 23:29:42 (UTC)
commit0076a11b467dce1233194ce228287a2a127b1f5d (patch) (unidiff)
treef2136a1a3e9b5fd6bede52251ed7249365838752 /noncore
parent48d9219a96096cf44df8ac24413b36d1b718b1d5 (diff)
downloadopie-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.
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/moveengine.cpp6
-rw-r--r--noncore/games/kbill/UI.cpp31
-rw-r--r--noncore/games/kcheckers/echeckers.cpp12
-rw-r--r--noncore/games/kcheckers/rcheckers.cpp36
-rw-r--r--noncore/settings/sysinfo/contrib/fft.c2
-rw-r--r--noncore/styles/theme/othemebase.cpp2
6 files changed, 51 insertions, 38 deletions
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index a4145cc..b102258 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -55,3 +55,4 @@ void MoveEngine::position(Pieces& pieces,bool non_qte)
55 { 55 {
56 pieces.player1[player1_counter].x=x_coord[a]-offset; 56 if (a < 26)
57 pieces.player1[player1_counter].x=x_coord[a]-offset;
57 if(a>=0 && a<13) 58 if(a>=0 && a<13)
@@ -98,3 +99,4 @@ void MoveEngine::position(Pieces& pieces,bool non_qte)
98 { 99 {
99 pieces.player2[player2_counter].x=x_coord[a]-offset; 100 if (a < 26)
101 pieces.player2[player2_counter].x=x_coord[a]-offset;
100 if(a>=0 && a<13) 102 if(a>=0 && a<13)
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
@@ -70,24 +70,23 @@ void UI::popup_dialog (int dialog) {
70 case Game::ENDGAME: 70 case Game::ENDGAME:
71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); 71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr));
72 break; 72 break;
73 case Game::HIGHSCORE: 73 case Game::HIGHSCORE:
74 //QMessageBox::message(("HighScore"), highscorestr); 74 break;
75 break; 75 case Game::ENTERNAME:
76 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));
78 bool state = b.exec() == 2; 78 bool state = b.exec() == 2;
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)
82 strcpy(str, "Anonymous"); 82 strcpy(str, "Anonymous");
83 else if ((nl = strchr(str, '\n'))) 83 else if ((nl = strchr(str, '\n')))
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); 87 }
88 } 88 break;
89 break;
90 case Game::SCORE: 89 case Game::SCORE:
91 QMessageBox::message(("Score"), scorestr); 90 QMessageBox::message(("Score"), scorestr);
92 break; 91 break;
93 } 92 }
diff --git a/noncore/games/kcheckers/echeckers.cpp b/noncore/games/kcheckers/echeckers.cpp
index 1146059..afe62eb 100644
--- a/noncore/games/kcheckers/echeckers.cpp
+++ b/noncore/games/kcheckers/echeckers.cpp
@@ -81,5 +81,5 @@ bool ECheckers::checkCapture1()
81 if(board[i+5]==MAN2 || board[i+5]==KING2) 81 if(board[i+5]==MAN2 || board[i+5]==KING2)
82 if(board[i+10]==FREE) return true; 82 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
83 if(board[i+6]==MAN2 || board[i+6]==KING2) 83 if(board[i+6]==MAN2 || board[i+6]==KING2)
84 if(board[i+12]==FREE) return true; 84 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
85 } 85 }
@@ -223,5 +223,5 @@ bool ECheckers::checkCapture2()
223 if(board[i+5]==MAN1 || board[i+5]==KING1) 223 if(board[i+5]==MAN1 || board[i+5]==KING1)
224 if(board[i+10]==FREE) return true; 224 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
225 if(board[i+6]==MAN1 || board[i+6]==KING1) 225 if(board[i+6]==MAN1 || board[i+6]==KING1)
226 if(board[i+12]==FREE) return true; 226 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
227 break; 227 break;
@@ -233,5 +233,5 @@ bool ECheckers::checkCapture2()
233 if(board[i+5]==MAN1 || board[i+5]==KING1) 233 if(board[i+5]==MAN1 || board[i+5]==KING1)
234 if(board[i+10]==FREE) return true; 234 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
235 if(board[i+6]==MAN1 || board[i+6]==KING1) 235 if(board[i+6]==MAN1 || board[i+6]==KING1)
236 if(board[i+12]==FREE) return true; 236 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
237 } 237 }
diff --git a/noncore/games/kcheckers/rcheckers.cpp b/noncore/games/kcheckers/rcheckers.cpp
index a1c7afa..d808780 100644
--- a/noncore/games/kcheckers/rcheckers.cpp
+++ b/noncore/games/kcheckers/rcheckers.cpp
@@ -114,5 +114,5 @@ bool RCheckers::checkCapture1()
114 if(board[i+5]==MAN2 || board[i+5]==KING2) 114 if(board[i+5]==MAN2 || board[i+5]==KING2)
115 if(board[i+10]==FREE) return true; 115 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
116 if(board[i+6]==MAN2 || board[i+6]==KING2) 116 if(board[i+6]==MAN2 || board[i+6]==KING2)
117 if(board[i+12]==FREE) return true; 117 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
118 break; 118 break;
@@ -128,9 +128,15 @@ bool RCheckers::checkCapture1()
128 128
129 for(k=i+5;board[k]==FREE;k+=5); 129 for(k=i+5;board[k]==FREE;k+=5) {
130 if (k >= 49)
131 break;
132 }
130 if(board[k]==MAN2 || board[k]==KING2) 133 if(board[k]==MAN2 || board[k]==KING2)
131 if(board[k+5]==FREE) return true; 134 if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
132 135
133 for(k=i+6;board[k]==FREE;k+=6); 136 for(k=i+6;board[k]==FREE;k+=6) {
137 if (k >=48)
138 break;
139 }
134 if(board[k]==MAN2 || board[k]==KING2) 140 if(board[k]==MAN2 || board[k]==KING2)
135 if(board[k+6]==FREE) return true; 141 if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
136 } 142 }
@@ -288,5 +294,5 @@ bool RCheckers::checkCapture2()
288 if(board[i+5]==MAN1 || board[i+5]==KING1) 294 if(board[i+5]==MAN1 || board[i+5]==KING1)
289 if(board[i+10]==FREE) return true; 295 if(board[((i+10) < 54) ? i+10 : 53]==FREE) return true;
290 if(board[i+6]==MAN1 || board[i+6]==KING1) 296 if(board[i+6]==MAN1 || board[i+6]==KING1)
291 if(board[i+12]==FREE) return true; 297 if(board[((i+12) < 54) ? i+12 : 53]==FREE) return true;
292 break; 298 break;
@@ -302,9 +308,15 @@ bool RCheckers::checkCapture2()
302 308
303 for(k=i+5;board[k]==FREE;k+=5); 309 for(k=i+5;board[k]==FREE;k+=5) {
310 if (k>=49)
311 break;
312 }
304 if(board[k]==MAN1 || board[k]==KING1) 313 if(board[k]==MAN1 || board[k]==KING1)
305 if(board[k+5]==FREE) return true; 314 if(board[((k+5) < 54) ? k+5 : 53]==FREE) return true;
306 315
307 for(k=i+6;board[k]==FREE;k+=6); 316 for(k=i+6;board[k]==FREE;k+=6) {
317 if (k>=48)
318 break;
319 }
308 if(board[k]==MAN1 || board[k]==KING1) 320 if(board[k]==MAN1 || board[k]==KING1)
309 if(board[k+6]==FREE) return true; 321 if(board[((k+6) < 54) ? k+6 : 53]==FREE) return true;
310 } 322 }
diff --git a/noncore/settings/sysinfo/contrib/fft.c b/noncore/settings/sysinfo/contrib/fft.c
index 01a1b26..60ee27d 100644
--- a/noncore/settings/sysinfo/contrib/fft.c
+++ b/noncore/settings/sysinfo/contrib/fft.c
@@ -31,3 +31,3 @@
31 31
32#define FFT_TEST_COUNT 500 // Bench FFT 32#define FFT_TEST_COUNT 332 // Bench FFT
33 33
diff --git a/noncore/styles/theme/othemebase.cpp b/noncore/styles/theme/othemebase.cpp
index 4275dd6..7fb12a3 100644
--- a/noncore/styles/theme/othemebase.cpp
+++ b/noncore/styles/theme/othemebase.cpp
@@ -1006,3 +1006,3 @@ void OThemeBase::readResourceGroup( int i, QString *copyfrom, QString *pixnames,
1006 } 1006 }
1007 if ( loadArray[ sIndex ] ) { 1007 if ( sIndex < 54 && loadArray[ sIndex ] ) {
1008 copyWidgetConfig( sIndex, i, pixnames, brdnames ); 1008 copyWidgetConfig( sIndex, i, pixnames, brdnames );