{"record":{"id":"84c0e5303f0c2c9b","repo":"peass-ng/PEASS-ng","slug":"str-84c0e5","errorCode":null,"errorMessage":"str","messagePattern":"str","errorType":"validation","errorClass":"ArgumentNullException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerGeneralString.cs","lineNumber":48,"sourceCode":"            if (isExplicit || o is DerGeneralString)\n            {\n                return GetInstance(o);\n            }\n\n            return new DerGeneralString(((Asn1OctetString)o).GetOctets());\n        }\n\n        public DerGeneralString(\n            byte[] str)\n            : this(Strings.FromAsciiByteArray(str))\n        {\n        }\n\n        public DerGeneralString(\n            string str)\n        {\n            if (str == null)\n                throw new ArgumentNullException(\"str\");\n\n            this.str = str;\n        }\n\n        public override string GetString()\n        {\n            return str;\n        }\n\n        public byte[] GetOctets()\n        {\n            return Strings.ToAsciiByteArray(str);\n        }\n\n        internal override void Encode(\n            DerOutputStream derOut)\n        {\n            derOut.WriteEncoded(Asn1Tags.GeneralString, GetOctets());","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerGeneralString.cs#L30-L66","documentation":"The DerGeneralString(string) constructor requires a non-null string; a null argument cannot be encoded as a GeneralString, so ArgumentNullException is raised immediately. This is standard fail-fast argument validation.","triggerScenarios":"Calling new DerGeneralString(null) directly, or passing a null string obtained from configuration, database, or parsed input into the constructor.","commonSituations":"Null config values or missing data fields fed into ASN.1 building code; API responses with absent string fields; refactoring that introduced a nullable string where a value was assumed.","solutions":["Pass a non-null string, substituting string.Empty or a default when the value may be absent","Null-check or coalesce before constructing: new DerGeneralString(str ?? \"\")","If absence must be represented, omit the ASN.1 element entirely rather than encoding null"],"exampleFix":"// before\nvar gs = new DerGeneralString(maybeNull);\n// after\nvar gs = new DerGeneralString(maybeNull ?? string.Empty);","handlingStrategy":"validation","validationCode":"var gs = str != null ? new DerGeneralString(str) : null;","typeGuard":null,"tryCatchPattern":"try { var gs = new DerGeneralString(str); }\ncatch (ArgumentNullException) { /* use default or omit element */ }","preventionTips":["Coalesce nulls before constructing ASN.1 string objects","Enable C# nullable reference types"],"tags":["asn1","bouncycastle","null-argument","argument-validation"],"backgroundTag":"null-argument","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}