Windows Security-Enhanced CRT 相关函数(即_s后辍函数)并不是对老函数的直接替代,其中不仅有更严格的参数检查,还会有buffer的重置操作等,使用的时候要格外小心,一定要仔细阅读MSDN描述或者VC runtime源码 (以Visual Studio 2008为例: C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\crt\src)。
下面不妨测试3个代码片段:
测试代码【C1】:
void main() {
char dst1[8];
memcpy(dst1, NULL, 0);
memcpy(NULL, NULL, 0);
}
测试代码【C2】:
void main() {
char dst1[8];
memcpy_s(dst1, 8, NULL, 0);
memcpy_s(NULL, 0, NULL, 0);
char *dst2 = (char *)malloc(0);
if (dst2) {
memcpy_s(dst2, 0, NULL, 0);
free(dst2);
}
}
测试代码【C3】:
void main() {
char dst1[8];
memcpy_s(NULL, 0, dst1, 8);
char *dst2 = (char *)malloc(0);
if (dst2) {
memcpy_s(dst2, 0, dst1, 8);
free(dst2);
}
}
这几段代码实际上什么也没有做,只是参数有变化而已,但测试中会发现【C3】会导致程序崩溃。具体原因就是因为memcpy_s进行了更严格的参数检测,可对参考memcpy_s的源码,引用自Visual Studio 2008 runtime source memcpy_s.c:
/***
* memcpy_s.c - contains memcpy_s routine
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* Purpose:
* memcpy_s() copies a source memory buffer to a destination buffer.
* Overlapping buffers are not treated specially, so propagation may occur.
*
*******************************************************************/
#include <cruntime.h>
#include <string.h>
#include <internal.h>
/***
* memcpy_s - Copy source buffer to destination buffer
*
* Purpose:
* memcpy_s() copies a source memory buffer to a destination memory buffer.
* This routine does NOT recognize overlapping buffers, and thus can lead
* to propagation.
*
* For cases where propagation must be avoided, memmove_s() must be used.
*
* Entry:
* void *dst = pointer to destination buffer
* size_t sizeInBytes = size in bytes of the destination buffer
* const void *src = pointer to source buffer
* size_t count = number of bytes to copy
*
* Exit:
* Returns 0 if everything is ok, else return the error code.
*
* Exceptions:
* Input parameters are validated. Refer to the validation section of the function.
* On error, the error code is returned and the destination buffer is zeroed.
*
*******************************************************************/
errno_t __cdecl memcpy_s(
void * dst,
size_t sizeInBytes,
const void * src,
size_t count
)
{
if (count == 0)
{
/* nothing to do */
return 0;
}
/* validation section */
_VALIDATE_RETURN_ERRCODE(dst != NULL, EINVAL);
if (src == NULL || sizeInBytes < count)
{
/* zeroes the destination buffer */
memset(dst, 0, sizeInBytes);
_VALIDATE_RETURN_ERRCODE(src != NULL, EINVAL);
_VALIDATE_RETURN_ERRCODE(sizeInBytes >= count, ERANGE);
/* useless, but prefast is confused */
return EINVAL;
}
memcpy(dst, src, count);
return 0;
}
参考阅读:
References:
Blackjacks findinall.com
References:
Lollybet Casino Mindesteinzahlung http://www.fouillez-tout.com
References:
Lollybet http://toolbarqueries.google.es/url?sa=t&source=web&rct=j&url=https://rabota.balletopedia.ru/companies/beste-online-casino-zahlungsmethoden-2026/
References:
Lollybet Casino Live Dealer https://gitea.belanjaparts.com/susanna23d308
References:
Payid online pokies australia http://krs-sro.ru/bitrix/redirect.php?goto=https://instantcasinodeutschland.de/fr-fr/
References:
Payid withdrawal pokies https://iridium.astroempires.com/
References:
Online pokies australia payid real money http://lj.rossia.org/meme.bml?url=https://instantcasinodeutschland.de/fr-fr/
References:
Flagman Casino Bonus https://s3.amazonaws.com
References:
Payid online pokies australia plb.moomoo.com
References:
Pokies net australia payid withdrawal kop16.ru
References:
Vegas Casino Online Bonus ohne Einzahlung https://s3.amazonaws.com/
References:
Lex Casino Einzahlung https://jandlfabricating.com/employer/schnelle-krypto-auszahlungen-10-cashback/
References:
Neosurf Casino Bonus maps.google.cz
References:
Candy96 member login https://jobbridge4you.com
References:
Candy96 official website https://employmentabroad.com/companies/candy96-online-casino-australia-100-welcome-bonus-and-other-bonuses
References:
Betsson Casino Test vmcworks.com
References:
Revolution Casino Test https://remotetechcareers.com/companies/instant-casino-auszahlung-mifinity-karten-und-krypto/
References:
Vulkan Spiele Casino Einzahlung https://bbs.tejiegm.com
References:
Candy96 mobile https://gladjobs.com/employer/50-free-spins-daily-bonus-access
References:
Bizzo Casino App https://s3.amazonaws.com/new-casino/Jack-Casino-Erfahrungen.html
References:
Hitnspin Casino Bewertung https://s3.amazonaws.com/new-casino/Casinomilyon-Bonus.html
References:
Winnita Casino Login http://cem200.ahlamontada.net/go/aHR0cHM6Ly93d3cuY2hhdHVyYmF0ZWNhbXMuY29tL2V4dGVybmFsX2xpbmsvP3VybD1odHRwczovL2luc3RhbnRjYXNpbm9kZXV0c2NobGFuZC5kZS8
References:
Total Casino Login http://rusnor.org/bitrix/redirect.php?event1&event2&event3&goto=http%3A%2F%2Fmaps.google.as%2Furl%3Fq%3Dhttps%3A%2F%2Finstantcasinodeutschland.de%2F</a
References:
Irwin Casino Einzahlung https://46.cholteth.com/index/d1?an&aurl=https://kellyoakleyphotography.com/?URL=https://www.arabtrvl.com/vb/redirect-to/?redirect=http%3a%2f%2finstantcasinodeutschland.de
References:
Amunra Casino Login http://palm.muk.uni-hannover.de/trac/search?q=https://card.addiscustom.com/enriquetatalbo
References:
Pandido Casino Einzahlung https://eric.ed.gov/?redir=https://dinfo.in.net/carenarce94502
References:
Sg Casino Erfahrungen https://cm.lesta.ru/frame/?backend_url=//bit.ly/opsuimolog5012&content_layout_max_width=1335&language=ru&login_url=https://dinfo.in.net/teshaeisenberg
References:
Poseidon Casino Bewertung https://shatunamur.ru/proxy.php?link=https://ekardz.com/jerroldtindal
References:
Luna Casino Auszahlung http://ww.visit-x.net/promo/dyn/dynchat02.php?pfmbanner=1&ver=12&clickurl=https://gratisafhalen.be/author/vyqroland3/
References:
Legiano Casino App http://nou-rau.uem.br/nou-rau/zeus/register.php?back=https%3A%2F%2Fzenithgrs.com%2Femployer%2Fbeste-krypto-casinos-2026-im-test-und-vergleich%2F
References:
Quickwin Casino Einzahlung http://logen.ru/bitrix/rk.php?goto=https://pracaeuropa.pl/companies/1go-casino-bonus-freispiele-2026/
References:
Solcasino Bonus ohne Einzahlung http://zanostroy.ru/go?url=https://www.jobindustrie.ma/companies/1go-casino-%e1%90%85-erfahrungen-test-bewertung/
References:
High Roller Casino Bonus https://www.workbay.online/profile/annabelledeuch
References:
Luck Casino Bonus https://omnicareersearch.com/employer/instant-casino-online-casino-mit-den-schnellsten-auszahlungen-in-deutschland/
References:
Starda Casino Bonus https://www.tokai-job.com/employer/instant-casino-app-erste-schritte-hauptfunktionen/
References:
Ho chunk casino madison https://1gocasinotest.onlinespielhallende.workers.dev/
References:
Holland Casino Bonus https://montenegro-racing.com/convert/index.php?action=profile;u=33348
References:
Bwin Casino Einzahlung http://users.atw.hu/oldfastmt2board/index.php?action=profile;u=33698
References:
Trusted payid pokies australia https://dachangningtongchengwang.qsygps.com/home.php?mod=space&uid=31013
Really liking the vibe here. Everything loads fast and the bonuses are actually fair compared to other places. Highly recommend br342bet
I love how fair the odds are on this platform. It gives me a lot more confidence in my bets. I’ll be sticking with br456betsim for a long time.
Customer support is actually helpful and quick to respond to my queries. Great service from phcahph.
Really appreciate the effort you put into this. I share similar content on instagram video downtown — would be great to exchange ideas sometime.
Nice article! I actually work on instagram video downtown and we have been exploring similar ideas lately. Great to see this perspective.
Really appreciate the effort you put into this. I share similar content on Old photo restoration — would be great to exchange ideas sometime.
The installation process was super easy and the app runs perfectly on my phone. Best way to play on the go for sure bingopattigamedownload