Skip to content

Commit

Permalink
fix Issue 23958 - ImportC: undefined identifier __builtin__sprintf_chk (
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Aug 4, 2023
1 parent 6fee586 commit 901c900
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions compiler/test/compilable/test23958.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// https://issues.dlang.org/show_bug.cgi?id=23958

#include <stdio.h>

int main() {
char buf[8];
sprintf(buf, "%d", 123);
}
1 change: 1 addition & 0 deletions druntime/src/importc.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
#define __builtin___strcpy_chk(dest, src, x) strcpy(dest,src)
#define __builtin___strncat_chk(dest, src, len, x) strncat(dest,src,len)
#define __builtin___strncpy_chk(dest, src, len, x) strncpy(dest,src,len)
#define __builtin___sprintf_chk(s, flag, os, fmt, ...) sprintf(s, fmt, __VA_ARGS__)
#endif

#if __FreeBSD__
Expand Down

0 comments on commit 901c900

Please sign in to comment.