Language: Java
Label: safe
CWE: CWE-502 \u2014 Deserialization of Untrusted Data
The product deserializes untrusted data without sufficiently verifying that the resulting data will be valid.

Code:
	public CraftingTemplate addCrafting() {
		
		if (!isEnabled()){
			return null;
		}
		
		BaseLogicCrafting craftingLogic = (BaseLogicCrafting) this.logic;
		ItemStack stack = craftingLogic.getCraftedItem(); 
		if (stack == null) return null;
		
		IRequestItems[] target = new IRequestItems[9];
		for(int i=0;i<9;i++) {
			target[i] = this;
		}

		boolean hasSatellite = craftingLogic.isSatelliteConnected();
		if(!hasSatellite) return null;
		if(!getUpgradeManager().isAdvancedSatelliteCrafter()) {
			if(craftingLogic.satelliteId != 0) {
				IRequestItems sat = (IRequestItems)craftingLogic.getSatelliteRouter(-1, -1).getPipe();
				for(int i=6;i<9;i++) {
					target[i] = sat;
				}
			}
		} else {
			for(int i=0;i<9;i++) {
				if(craftingLogic.advancedSatelliteIdArray[i] != 0) {
					target[i] = (IRequestItems)craftingLogic.getSatelliteRouter(i, -1).getPipe();
				}
			}
		}

		CraftingTemplate template = new CraftingTemplate(ItemIdentifierStack.GetFromStack(stack), this, craftingLogic.priority);

		//Check all materials
		for (int i = 0; i < 9; i++){
			ItemStack resourceStack = craftingLogic.getMaterials(i);
			if (resourceStack == null || resourceStack.stackSize == 0) continue;
			template.addRequirement(ItemIdentifierStack.GetFromStack(resourceStack), target[i]);
				
		}
		return template;
	}