summaryrefslogtreecommitdiff
authorzecke <zecke>2005-01-09 16:27:40 (UTC)
committer zecke <zecke>2005-01-09 16:27:40 (UTC)
commitebd352b30b5b0278e613e1d1ecc60a5fc7756961 (patch) (unidiff)
tree0a7967a8cf668bf06fd949fbc7e1c9c33043fc60
parentc6432d421a0ec3d158bf40309e98fc0386c4a287 (diff)
downloadopie-ebd352b30b5b0278e613e1d1ecc60a5fc7756961.zip
opie-ebd352b30b5b0278e613e1d1ecc60a5fc7756961.tar.gz
opie-ebd352b30b5b0278e613e1d1ecc60a5fc7756961.tar.bz2
-Do not access the Array out of bounds
-Check that there is a driver before asking to query a non existant
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTGateway.cpp1
-rw-r--r--noncore/settings/networksettings2/opietooth2/OTGateway.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
index e8137dd..1b61a2e 100644
--- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
+++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp
@@ -136,24 +136,25 @@ void OTGateway::SLOT_Enable() {
136} 136}
137 137
138void OTGateway::SLOT_Disable() { 138void OTGateway::SLOT_Disable() {
139 getOTDevice()->detach(); 139 getOTDevice()->detach();
140} 140}
141 141
142bool OTGateway::needsEnabling() { 142bool OTGateway::needsEnabling() {
143 return getOTDevice()->needsAttach(); 143 return getOTDevice()->needsAttach();
144} 144}
145 145
146bool OTGateway::isEnabled() { 146bool OTGateway::isEnabled() {
147 if( getOTDevice()->deviceNr() >= 0 && 147 if( getOTDevice()->deviceNr() >= 0 &&
148 AllDrivers.count() != 0 &&
148 driver( getOTDevice()->deviceNr() )->isUp() ) 149 driver( getOTDevice()->deviceNr() )->isUp() )
149 return TRUE; 150 return TRUE;
150 151
151 // else check system 152 // else check system
152 return getOTDevice()->isAttached(); 153 return getOTDevice()->isAttached();
153} 154}
154 155
155void OTGateway::SLOT_ShowError( const QString & S ) { 156void OTGateway::SLOT_ShowError( const QString & S ) {
156 157
157 odebug << S << oendl; 158 odebug << S << oendl;
158 159
159 if( ErrorConnectCount > 0 ) { 160 if( ErrorConnectCount > 0 ) {
diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h
index d97ef35..11c6b30 100644
--- a/noncore/settings/networksettings2/opietooth2/OTGateway.h
+++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h
@@ -80,25 +80,25 @@ public :
80 // return true if this device needs enabling of bluetooth 80 // return true if this device needs enabling of bluetooth
81 bool needsEnabling(); 81 bool needsEnabling();
82 // return true if system is running 82 // return true if system is running
83 bool isEnabled(); 83 bool isEnabled();
84 void setRefreshTimer( int MilleSecs ); 84 void setRefreshTimer( int MilleSecs );
85 // return socket to HCI raw layer 85 // return socket to HCI raw layer
86 inline int getSocket() 86 inline int getSocket()
87 { return HciCtl; } 87 { return HciCtl; }
88 88
89 OTDriverList & getDriverList() 89 OTDriverList & getDriverList()
90 { return AllDrivers; } 90 { return AllDrivers; }
91 OTDriver * driver( int nr ) 91 OTDriver * driver( int nr )
92 { return AllDrivers[nr]; } 92 { return AllDrivers.count() == 0 ? 0 : AllDrivers[nr]; }
93 void updateDrivers(); 93 void updateDrivers();
94 94
95 PANConnectionVector getPANConnections(); 95 PANConnectionVector getPANConnections();
96 96
97 // scan neighbourhood using device 97 // scan neighbourhood using device
98 void scanNeighbourhood( OTDriver * D = 0 ); 98 void scanNeighbourhood( OTDriver * D = 0 );
99 void stopScanOfNeighbourhood(void ); 99 void stopScanOfNeighbourhood(void );
100 void setScanWith( OTDriver * D = 0 ) 100 void setScanWith( OTDriver * D = 0 )
101 { ScanWith = (D) ? D : 101 { ScanWith = (D) ? D :
102 (AllDrivers.count() ) ? AllDrivers[0] : 0; } 102 (AllDrivers.count() ) ? AllDrivers[0] : 0; }
103 OTDriver * scanWith( void ) 103 OTDriver * scanWith( void )
104 { return ScanWith; } 104 { return ScanWith; }