Add a few more validity checks
This commit is contained in:
		| @@ -164,7 +164,7 @@ function uupFetchUpd( | ||||
|         'updateTitle' => $updateArray[0]['updateTitle'], | ||||
|         'foundBuild' => $updateArray[0]['foundBuild'], | ||||
|         'arch' => $updateArray[0]['arch'], | ||||
|         'fileWrite' => $updateArray[0]['foundBuild'], | ||||
|         'fileWrite' => $updateArray[0]['fileWrite'], | ||||
|         'updateArray' => $updateArray, | ||||
|     ); | ||||
| } | ||||
|   | ||||
							
								
								
									
										8
									
								
								get.php
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								get.php
									
									
									
									
									
								
							| @@ -37,6 +37,14 @@ function uupGetFiles( | ||||
| ) { | ||||
|     uupApiPrintBrand(); | ||||
|  | ||||
|     if(!$updateId) { | ||||
|         return array('error' => 'UNSPECIFIED_UPDATE'); | ||||
|     } | ||||
|  | ||||
|     if(!uupApiCheckUpdateId($updateId)) { | ||||
|             return array('error' => 'INCORRECT_ID'); | ||||
|     } | ||||
|  | ||||
|     $info = @file_get_contents('fileinfo/'.$updateId.'.json'); | ||||
|     if(empty($info)) { | ||||
|         $info = array( | ||||
|   | ||||
| @@ -24,6 +24,10 @@ function uupListEditions($lang = 'en-us', $updateId = 0) { | ||||
|         $info = uupUpdateInfo($updateId); | ||||
|     } | ||||
|  | ||||
|     if(!$lang) { | ||||
|         return array('error' => 'UNSUPPORTED_LANG'); | ||||
|     } | ||||
|  | ||||
|     if(isset($info['info'])) $info = $info['info']; | ||||
|  | ||||
|     if(isset($info['build'])) { | ||||
|   | ||||
| @@ -16,7 +16,7 @@ limitations under the License. | ||||
| */ | ||||
|  | ||||
| function uupApiVersion() { | ||||
|     return '1.26.2'; | ||||
|     return '1.27.0'; | ||||
| } | ||||
|  | ||||
| require_once dirname(__FILE__).'/auths.php'; | ||||
|   | ||||
| @@ -113,3 +113,10 @@ function uupDumpApiGetDebug() { | ||||
|     $data = parse_ini_file('debug.ini'); | ||||
|     return $data; | ||||
| } | ||||
|  | ||||
| function uupApiCheckUpdateId($updateId) { | ||||
|     return preg_match( | ||||
|         '/^[\da-fA-F]{8}-([\da-fA-F]{4}-){3}[\da-fA-F]{12}(_rev\.\d+)?$/', | ||||
|         $updateId | ||||
|     ); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user