diff options
author | norrath-hero-cn <73905273+norrath-hero-cn@users.noreply.github.com> | 2023-08-05 01:59:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 19:59:05 +0200 |
commit | 73a29d72e347817a239f097c8185842e5bdca149 (patch) | |
tree | cada3b6859eb9ade70dc39a88d38fb995f588079 | |
parent | 26f183043f9e58eb4954d50a5d130d8684909936 (diff) | |
download | Nim-73a29d72e347817a239f097c8185842e5bdca149.tar.gz |
fixes AddressSanitizer: global-buffer-overflow in getAppFilename on windows 10 (#22380)
fixes AddressSanitizer: global-buffer-overflow
-rw-r--r-- | lib/pure/os.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 434fc3a26..13c6d6113 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -638,14 +638,14 @@ proc getAppFilename*(): string {.rtl, extern: "nos$1", tags: [ReadIOEffect], noW # /proc/<pid>/path/a.out (complete pathname) when defined(windows): var bufsize = int32(MAX_PATH) - var buf = newWideCString("", bufsize) + var buf = newWideCString(bufsize) while true: var L = getModuleFileNameW(0, buf, bufsize) if L == 0'i32: result = "" # error! break elif L > bufsize: - buf = newWideCString("", L) + buf = newWideCString(L) bufsize = L else: result = buf$L |