Ticket #4938: redundant_length_check.patch
File redundant_length_check.patch, 1.4 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/mhi.cpp
28 28 int m_y; 29 29 }; 30 30 31 // Special value sfor the NetworkBootInfo version. Real values are a byte.31 // Special value for the NetworkBootInfo version. Real values are a byte. 32 32 #define NBI_VERSION_UNSET 257 33 #define NBI_VERSION_ABSENT 25634 33 35 34 MHIContext::MHIContext(InteractiveTV *parent) 36 35 : m_parent(parent), m_dsmcc(NULL), … … 280 279 // A NetworkBootInfo sub-descriptor is present in the PMT. 281 280 void MHIContext::SetNetBootInfo(const unsigned char *data, uint length) 282 281 { 283 if (length < 2) return; // Temporary hack? -- dtk May 5th, 2008. 282 if (length < 2) // A valid descriptor should always have at least 2 bytes. 283 return; 284 284 QMutexLocker locker(&m_dsmccLock); 285 285 // Save the data from the descriptor. 286 286 m_nbiData.resize(0); … … 288 288 m_nbiData.insert(m_nbiData.begin(), data, data+length); 289 289 // If there is no Network Boot Info or we're setting it 290 290 // for the first time just update the "last version". 291 if (length < 2) 292 m_lastNbiVersion = NBI_VERSION_ABSENT; 293 else if (m_lastNbiVersion == NBI_VERSION_UNSET) 291 if (m_lastNbiVersion == NBI_VERSION_UNSET) 294 292 m_lastNbiVersion = data[0]; 295 293 else 296 294 m_engine_wait.wakeAll();