{"record":{"id":"afbdab4033dc409e","repo":"NationalSecurityAgency/ghidra","slug":"bad-characters-in-proposed-function-tag-afbdab","errorCode":null,"errorMessage":"Bad characters in proposed function tag","messagePattern":"Bad characters in proposed function tag","errorType":"validation","errorClass":"LSHException","httpStatus":null,"severity":"error","filePath":"Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java","lineNumber":2958,"sourceCode":"\t\tif (info.execats == null) {\n\t\t\tinfo.execats = new ArrayList<>();\n\t\t}\n\t\tinfo.execats.add(query.type_name);\n\t\twriteExecutableCategories();\n\t\tresponse.info = info;\n\t}\n\n\t/**\n\t * Entry point for the Elasticsearch version of InstallTagRequest command:\n\t *   Install a new function tag to be managed by this data\n\t * @param query is command parameters\n\t * @throws LSHException if the command is misconfigured\n\t * @throws ElasticException for communication problems with the server\n\t */\n\tprivate void fdbInstallTag(InstallTagRequest query) throws LSHException, ElasticException {\n\t\tfinal ResponseInfo response = query.installresponse;\n\t\tif (!CategoryRecord.enforceTypeCharacters(query.tag_name)) {\n\t\t\tthrow new LSHException(\"Bad characters in proposed function tag\");\n\t\t}\n\t\t// Check for existing tag\n\t\tif (info.functionTags != null) {\n\t\t\tif (info.functionTags.contains(query.tag_name)) {\n\t\t\t\tthrow new LSHException(\"Function tag already exists\");\n\t\t\t}\n\t\t}\n\t\tif (info.functionTags == null) {\n\t\t\tinfo.functionTags = new ArrayList<>();\n\t\t}\n\t\t// There are only 32-bits of space in the function record reserved for storing the presence of tags\n\t\tif (info.functionTags.size() >= FunctionTagBSimFilterType.MAX_TAG_COUNT) {\n\t\t\tthrow new LSHException(\n\t\t\t\t\"Cannot allocate new function tag: \" + query.tag_name + \" - Column space is full\");\n\t\t}\n\t\tinfo.functionTags.add(query.tag_name);\n\t\twriteFunctionTags();\n\t\tresponse.info = info;","sourceCodeStart":2940,"sourceCodeEnd":2976,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/elastic/ElasticDatabase.java#L2940-L2976","documentation":"fdbInstallTag validates query.tag_name with enforceTypeCharacters; failure throws LSHException(\"Bad characters in proposed function tag\").","triggerScenarios":"An InstallTagRequest whose tag_name is None, empty, or contains characters outside the allowed set.","commonSituations":"Tag name derived from a Ghidra symbol/label containing '@', '*', '[]', '<>', etc.; empty value from a missing arg.","solutions":["Sanitize tag_name to the allowed character set before issuing the request.","Reject null/empty tag names upstream."],"exampleFix":"// before\nreq.tag_name = symbol; // 'thunk@plt'\n// after\nreq.tag_name = sanitize(symbol); // 'thunk_plt'","handlingStrategy":"validation","validationCode":"if (!CategoryRecord.enforceTypeCharacters(req.tag_name))\n    throw new IllegalArgumentException(\"Invalid tag name: \" + req.tag_name);","typeGuard":"boolean validTag = CategoryRecord.enforceTypeCharacters(name);","tryCatchPattern":null,"preventionTips":["Map symbol names to a safe tag namespace before install."],"tags":["bsim","tag","validation","input-sanitization"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}