mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	Protect Boblight server against clients sending too much data
Former-commit-id: f3a575f71425da25fbaad68c48dcec746a50def2
This commit is contained in:
		| @@ -67,6 +67,13 @@ void BoblightClientConnection::readData() | ||||
| 		// handle message | ||||
| 		handleMessage(message); | ||||
|  | ||||
| 		// drop messages if the buffer is too full | ||||
| 		if (_receiveBuffer.size() > 100*1024) | ||||
| 		{ | ||||
| 			std::cout << "Boblight server drops messages" << std::endl; | ||||
| 			_receiveBuffer.clear(); | ||||
| 		} | ||||
|  | ||||
| 		// try too look up '\n' again | ||||
| 		bytes = _receiveBuffer.indexOf('\n') + 1; | ||||
| 	} | ||||
| @@ -183,6 +190,7 @@ void BoblightClientConnection::handleMessage(const QString & message) | ||||
| 			{ | ||||
| 				_hyperion->setColors(_priority, _ledColors, -1); | ||||
| 			} | ||||
| 			return; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
|   | ||||
| @@ -32,6 +32,9 @@ | ||||
| void signal_handler(const int signum) | ||||
| { | ||||
| 	QCoreApplication::quit(); | ||||
|  | ||||
| 	// reset signal handler to default (in case this handler is not capable of stopping) | ||||
| 	signal(signum, SIG_DFL); | ||||
| } | ||||
|  | ||||
| Json::Value loadConfig(const std::string & configFile) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user