瀏覽代碼

tstringconstnode.changestringtype: fix buffer overrun

Found by asan
Jonas Maebe 3 年之前
父節點
當前提交
6dc47c71fb
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      compiler/ncon.pas

+ 1 - 1
compiler/ncon.pas

@@ -1146,8 +1146,8 @@ implementation
                           l:=UnicodeToUtf8(nil,0,PUnicodeChar(pw^.data),len);
                           if l<>len then
                             ReAllocMem(value_str,l);
+                          UnicodeToUtf8(value_str,l,PUnicodeChar(pw^.data),len);
                           len:=l-1;
-                          UnicodeToUtf8(value_str,PUnicodeChar(pw^.data),l);
                           donewidestring(pw);
                         end
                       else