private int checkUnicodeString(Memory mem, Address adref) {
		int len = getWStrLen(mem, adref); // returns -1 for bad

		if (len <= 0) {
			return 0;
		}

		int len2 = getWStrLen(mem, adref.subtractWrap(8));
		if (len2 > len + 2) {
			return 0;
		}

		if (len > 3) {
			return len;
		}

		return 0;
	}
Returns the length of the Unicode string found at address.

@return length of string in words (two byte unicode characters).
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/analysis/OperandReferenceAnalyzer.java