Message ID | 20171010231130.6832-1-simon@rozman.si |
---|---|
State | Superseded |
Headers | show |
Series | [Openvpn-devel,01/13] snwprintf() => _snwprintf() | expand |
Hi Simon, From a technical point of view, it looks like a fine patch. But it is hard for me (as a non-Windows dev) to understand *why* this is needed. It would be good to explain the rationale for a change so others can understand it as quickly as possible. I won't dive deep into how to write good commit messages here, as this blog post covers it very well: <https://chris.beams.io/posts/git-commit/> For this particular patch, I hope Selva or Heiko get a chance to chime in with their technical review.
Hi, > From a technical point of view, it looks like a fine patch. But it is hard > for me > (as a non-Windows dev) to understand *why* this is needed. > It would be good to explain the rationale for a change so others can > understand it as quickly as possible. snwprintf() is not defined in Windows SDK. _snwprintf() is. [https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l] Mingw probably accepts both. That's why nobody noticed. Looking around OpenVPN code, I have found some code using _snwprintf(), some snwprintf(). Probably, since MSVC was neglected for so long, nobody paid attention to such a subtle difference. For the code to compile on MSVC all snwprintf() should be replaced with _snwprintf(). Or, since the prefix underscore imposed by Windows SDK is not mostly aesthetical, the following #define could be introduced: #ifdef _MSVC_VER #define snwprintf _snwprintf #endif Nevertheless, I suggest consistent use of snwprintf/_snwprintf. > I won't dive deep into how to write good commit messages here, as this blog > post covers it very well: <https://chris.beams.io/posts/git-commit/> Please apologize. I'll learn. Thank you for pointing me in the right direction. Best regards, Simon ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
On Wed, Oct 11, 2017 at 6:06 AM, Simon Rozman <simon@rozman.si> wrote: > Hi, > > > From a technical point of view, it looks like a fine patch. But it is > hard > > for me > > (as a non-Windows dev) to understand *why* this is needed. > > It would be good to explain the rationale for a change so others can > > understand it as quickly as possible. > > snwprintf() is not defined in Windows SDK. _snwprintf() is. > [https://docs.microsoft.com/en-us/cpp/c-runtime-library/ > reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l] > > Mingw probably accepts both. That's why nobody noticed. Looking around > OpenVPN > code, I have found some code using _snwprintf(), some snwprintf(). > Probably, > since MSVC was neglected for so long, nobody paid attention to such a > subtle > difference. > > For the code to compile on MSVC all snwprintf() should be replaced with > _snwprintf(). Or, since the prefix underscore imposed by Windows SDK is not > mostly aesthetical, the following #define could be introduced: > #ifdef _MSVC_VER > #define snwprintf _snwprintf > #endif > > Nevertheless, I suggest consistent use of snwprintf/_snwprintf. > While its true that mingw accepts both and Windows has only the latter, I think the best option here is swprintf. Its ISO-C, does the same thing as _snwprintf with added advantage that nul-termination is guaranteed by the standard (though we need not bank on that and better continue the practice of explicit nul termination). Note that swprintf is like snprintf in that it takes the buffer size as an argument. Selva <div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 11, 2017 at 6:06 AM, Simon Rozman <span dir="ltr"><<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br> <span class=""><br> > From a technical point of view, it looks like a fine patch. But it is hard<br> > for me<br> > (as a non-Windows dev) to understand *why* this is needed.<br> > It would be good to explain the rationale for a change so others can<br> > understand it as quickly as possible.<br> <br> </span>snwprintf() is not defined in Windows SDK. _snwprintf() is.<br> [<a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l" rel="noreferrer" target="_blank">https://docs.microsoft.com/<wbr>en-us/cpp/c-runtime-library/<wbr>reference/snprintf-snprintf-<wbr>snprintf-l-snwprintf-<wbr>snwprintf-l</a>]<br> <br> Mingw probably accepts both. That's why nobody noticed. Looking around OpenVPN<br> code, I have found some code using _snwprintf(), some snwprintf(). Probably,<br> since MSVC was neglected for so long, nobody paid attention to such a subtle<br> difference.<br> <br> For the code to compile on MSVC all snwprintf() should be replaced with<br> _snwprintf(). Or, since the prefix underscore imposed by Windows SDK is not<br> mostly aesthetical, the following #define could be introduced:<br> #ifdef _MSVC_VER<br> #define snwprintf _snwprintf<br> #endif<br> <br> Nevertheless, I suggest consistent use of snwprintf/_snwprintf.<br></blockquote><div><br></div><div> </div><div>While its true that mingw accepts both and Windows has only the latter, I think the best option here is swprintf. Its ISO-C, does the same thing as _snwprintf with added advantage that nul-termination is guaranteed by the standard (though we need not bank on that and better continue the practice of explicit nul termination). Note that swprintf is like snprintf in that it takes the buffer size as an argument.</div><div><br></div><div>Selva</div><div><br></div><div> <br></div></div></div></div> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi, I agree migration towards ISO-C's snwprintf() is better. We can do it two way: using #define, or implementing a simple wrapper function. The advantage of wrapper function is we can introduce guaranteed null-terminated output to match ISO-C experience. Best regards, Simon From: Selva [mailto:selva.nair@gmail.com] Sent: Wednesday, October 11, 2017 3:20 PM To: Simon Rozman Cc: openvpn-devel@lists.sourceforge.net Subject: Re: [Openvpn-devel] [PATCH 01/13] snwprintf() => _snwprintf() On Wed, Oct 11, 2017 at 6:06 AM, Simon Rozman <simon@rozman.si> wrote: Hi, > From a technical point of view, it looks like a fine patch. But it is hard > for me > (as a non-Windows dev) to understand *why* this is needed. > It would be good to explain the rationale for a change so others can > understand it as quickly as possible. snwprintf() is not defined in Windows SDK. _snwprintf() is. [https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l] Mingw probably accepts both. That's why nobody noticed. Looking around OpenVPN code, I have found some code using _snwprintf(), some snwprintf(). Probably, since MSVC was neglected for so long, nobody paid attention to such a subtle difference. For the code to compile on MSVC all snwprintf() should be replaced with _snwprintf(). Or, since the prefix underscore imposed by Windows SDK is not mostly aesthetical, the following #define could be introduced: #ifdef _MSVC_VER #define snwprintf _snwprintf #endif Nevertheless, I suggest consistent use of snwprintf/_snwprintf. While its true that mingw accepts both and Windows has only the latter, I think the best option here is swprintf. Its ISO-C, does the same thing as _snwprintf with added advantage that nul-termination is guaranteed by the standard (though we need not bank on that and better continue the practice of explicit nul termination). Note that swprintf is like snprintf in that it takes the buffer size as an argument. Selva <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!-- /* Font Definitions */ @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:Tahoma; panose-1:2 11 6 4 3 5 4 4 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman","serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} code {mso-style-priority:99; font-family:"Courier New";} p.MsoQuote, li.MsoQuote, div.MsoQuote {mso-style-priority:29; mso-style-link:"Quote Char"; margin:0cm; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Calibri","sans-serif"; font-style:italic;} span.QuoteChar {mso-style-name:"Quote Char"; mso-style-priority:29; mso-style-link:Quote; font-family:"Calibri","sans-serif"; font-style:italic;} span.EmailStyle20 {mso-style-type:personal-reply; font-family:"Calibri","sans-serif"; color:#1F497D;} .MsoChpDefault {mso-style-type:export-only; font-family:"Calibri","sans-serif"; mso-fareast-language:EN-US;} @page WordSection1 {size:612.0pt 792.0pt; margin:70.85pt 70.85pt 70.85pt 70.85pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--></head><body lang=SL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I agree migration towards ISO-C's snwprintf() is better.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>We can do it two way: using #define, or implementing a simple wrapper function. The advantage of wrapper function is we can introduce guaranteed null-terminated output to match ISO-C experience.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Simon<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Selva [mailto:selva.nair@gmail.com] <br><b>Sent:</b> Wednesday, October 11, 2017 3:20 PM<br><b>To:</b> Simon Rozman<br><b>Cc:</b> openvpn-devel@lists.sourceforge.net<br><b>Subject:</b> Re: [Openvpn-devel] [PATCH 01/13] snwprintf() => _snwprintf()<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Oct 11, 2017 at 6:06 AM, Simon Rozman <<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Hi,<br><br>> From a technical point of view, it looks like a fine patch. But it is hard<br>> for me<br>> (as a non-Windows dev) to understand *why* this is needed.<br>> It would be good to explain the rationale for a change so others can<br>> understand it as quickly as possible.<br><br>snwprintf() is not defined in Windows SDK. _snwprintf() is.<br>[<a href="https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l" target="_blank">https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/snprintf-snprintf-snprintf-l-snwprintf-snwprintf-l</a>]<br><br>Mingw probably accepts both. That's why nobody noticed. Looking around OpenVPN<br>code, I have found some code using _snwprintf(), some snwprintf(). Probably,<br>since MSVC was neglected for so long, nobody paid attention to such a subtle<br>difference.<br><br>For the code to compile on MSVC all snwprintf() should be replaced with<br>_snwprintf(). Or, since the prefix underscore imposed by Windows SDK is not<br>mostly aesthetical, the following #define could be introduced:<br>#ifdef _MSVC_VER<br>#define snwprintf _snwprintf<br>#endif<br><br>Nevertheless, I suggest consistent use of snwprintf/_snwprintf.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>While its true that mingw accepts both and Windows has only the latter, I think the best option here is swprintf. Its ISO-C, does the same thing as _snwprintf with added advantage that nul-termination is guaranteed by the standard (though we need not bank on that and better continue the practice of explicit nul termination). Note that swprintf is like snprintf in that it takes the buffer size as an argument.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Selva<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div></div></div></div></div></div></body></html> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi On Wed, Oct 11, 2017 at 10:03 AM, Simon Rozman <simon@rozman.si> wrote: > Hi, > > > > I agree migration towards ISO-C's snwprintf() is better. > Just to be sure, ISO-C is 'swprintf' not 'snwprintf'. In spite of 'n' misisng from that name, it takes the buffer size argument and nul terminates even if output is truncated. <div dir="ltr">Hi<br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 11, 2017 at 10:03 AM, Simon Rozman <span dir="ltr"><<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="SL" link="blue" vlink="purple"><div class="m_-8897449481704970227WordSection1"><p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-GB" style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I agree migration towards ISO-C's snwprintf() is better.</span></p></div></div></blockquote><div><br></div><div>Just to be sure, ISO-C is 'swprintf' not 'snwprintf'. In spite of 'n' misisng from that name, it takes the buffer size argument and nul terminates even if output is truncated.<br></div></div></div></div> ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Hi,
Thank you for your feedback.
Based on it, I have sent a new patch "[PATCH] Uniform snwprintf() across MinGW
and MSVC compilers", that supersedes this one.
Best regards,
Simon
From: Selva [mailto:selva.nair@gmail.com]
Sent: Wednesday, October 11, 2017 4:32 PM
To: Simon Rozman
Cc: openvpn-devel@lists.sourceforge.net
Subject: Re: [Openvpn-devel] [PATCH 01/13] snwprintf() => _snwprintf()
Hi
On Wed, Oct 11, 2017 at 10:03 AM, Simon Rozman <simon@rozman.si> wrote:
Hi,
I agree migration towards ISO-C's snwprintf() is better.
Just to be sure, ISO-C is 'swprintf' not 'snwprintf'. In spite of 'n' misisng
from that name, it takes the buffer size argument and nul terminates even if
output is truncated.
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
code
{mso-style-priority:99;
font-family:"Courier New";}
p.MsoQuote, li.MsoQuote, div.MsoQuote
{mso-style-priority:29;
mso-style-link:"Quote Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Calibri","sans-serif";
font-style:italic;}
span.QuoteChar
{mso-style-name:"Quote Char";
mso-style-priority:29;
mso-style-link:Quote;
font-family:"Calibri","sans-serif";
font-style:italic;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=SL link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you for your feedback.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Based on it, I have sent a new patch "[PATCH] Uniform snwprintf() across MinGW and MSVC compilers", that supersedes this one.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Best regards,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Simon<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Selva [mailto:selva.nair@gmail.com] <br><b>Sent:</b> Wednesday, October 11, 2017 4:32 PM<br><b>To:</b> Simon Rozman<br><b>Cc:</b> openvpn-devel@lists.sourceforge.net<br><b>Subject:</b> Re: [Openvpn-devel] [PATCH 01/13] snwprintf() => _snwprintf()<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Wed, Oct 11, 2017 at 10:03 AM, Simon Rozman <<a href="mailto:simon@rozman.si" target="_blank">simon@rozman.si</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Hi,</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span lang=EN-GB style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I agree migration towards ISO-C's snwprintf() is better.</span><o:p></o:p></p></div></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Just to be sure, ISO-C is 'swprintf' not 'snwprintf'. In spite of 'n' misisng from that name, it takes the buffer size argument and nul terminates even if output is truncated.<o:p></o:p></p></div></div></div></div></div></div></body></html>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index fe9c7d6..9d473e4 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -402,8 +402,8 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) if (!CheckOption(workdir, 2, argv_tmp, &settings)) { - snwprintf(buf, _countof(buf), msg1, argv[0], workdir, - settings.ovpn_admin_group); + _snwprintf(buf, _countof(buf), msg1, argv[0], workdir, + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } @@ -421,15 +421,15 @@ ValidateOptions(HANDLE pipe, const WCHAR *workdir, const WCHAR *options) { if (wcscmp(L"--config", argv[i]) == 0 && argc-i > 1) { - snwprintf(buf, _countof(buf), msg1, argv[i+1], workdir, - settings.ovpn_admin_group); + _snwprintf(buf, _countof(buf), msg1, argv[i+1], workdir, + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } else { - snwprintf(buf, _countof(buf), msg2, argv[i], - settings.ovpn_admin_group); + _snwprintf(buf, _countof(buf), msg2, argv[i], + settings.ovpn_admin_group); buf[_countof(buf) - 1] = L'\0'; ReturnError(pipe, ERROR_STARTUP_DATA, buf, 1, &exit_event); } diff --git a/src/openvpnserv/validate.c b/src/openvpnserv/validate.c index f6a97e9..7a2d0e3 100644 --- a/src/openvpnserv/validate.c +++ b/src/openvpnserv/validate.c @@ -65,7 +65,7 @@ CheckConfigPath(const WCHAR *workdir, const WCHAR *fname, const settings_t *s) /* convert fname to full path */ if (PathIsRelativeW(fname) ) { - snwprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); + _snwprintf(tmp, _countof(tmp), L"%s\\%s", workdir, fname); tmp[_countof(tmp)-1] = L'\0'; config_file = tmp; }
From: Simon Rozman <simon@rozman.si> --- src/openvpnserv/interactive.c | 12 ++++++------ src/openvpnserv/validate.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)