Skip to content

Commit

Permalink
fix visual studio unsafe error
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian8j2 committed Feb 26, 2021
1 parent 6b85551 commit 44b74b2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion include/ClipboardXX.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ class CClipboardWindows: public IClipboardOS{
throw CExceptionXX("Cannot empty clipboard!");

HGLOBAL pGlobal = GlobalAlloc(GMEM_FIXED, (Length + 1)* sizeof(char));
strncpy((char *)pGlobal, pText, Length);

#ifdef _MSC_VER
strcpy_s((char *)pGlobal, (Length + 1)*sizeof(char), pText);
#else
strncpy((char *)pGlobal, pText, Length);
#endif

SetClipboardData(CF_TEXT, pGlobal);

GlobalFree(pGlobal);
Expand Down

0 comments on commit 44b74b2

Please sign in to comment.