노현종

VulnC 작성중...

...@@ -37,12 +37,40 @@ namespace VulnCrawler ...@@ -37,12 +37,40 @@ namespace VulnCrawler
37 protected override string GetOriginalFunc(Stream oldStream, string methodName) { 37 protected override string GetOriginalFunc(Stream oldStream, string methodName) {
38 StringBuilder oldBuilder = new StringBuilder(); 38 StringBuilder oldBuilder = new StringBuilder();
39 using (var reader = new StreamReader(oldStream)) { 39 using (var reader = new StreamReader(oldStream)) {
40 - int defSpace = 0; 40 +
41 + bool found = false;
42 + int bracketCount = -1;
41 while (!reader.EndOfStream) { 43 while (!reader.EndOfStream) {
42 string line = reader.ReadLine(); 44 string line = reader.ReadLine();
45 +
46 + if (found)
47 + {
48 +
49 + int openBracketCount = line.Count(c => c == '{');
50 + int closeBracketCount = line.Count(c => c == '}');
51 +
52 + if (bracketCount == -1)
53 + {
54 +
55 + }
56 + if (line.Count(c => c == '{') > 0)
57 + {
58 +
59 + }
60 + }
61 +
43 if (Regex.Match(line, $@"{methodName}").Success) { 62 if (Regex.Match(line, $@"{methodName}").Success) {
44 - defSpace = line.IndexOf(methodName); 63 + found = true;
64 + int openBracketCount = line.Count(c => c == '{');
65 + int closeBracketCount = line.Count(c => c == '}');
66 + int subtract = openBracketCount - closeBracketCount;
45 oldBuilder.AppendLine(line); 67 oldBuilder.AppendLine(line);
68 +
69 + if (subtract < 0)
70 + {
71 + break;
72 + }
73 + bracketCount = subtract;
46 } 74 }
47 75
48 } 76 }
......