Skip to content

Commit 714c256

Browse files
author
Rohit Kesarwani
committed
fix checkmark
1 parent b15cd4b commit 714c256

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

NVPClient/NVPClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ static const wchar_t CLIENT_APPLICATION[] = L"clientApplication";
6464
#define RETURN_ERROR1( status, info, arg1 ) \
6565
{ \
6666
char szErrorBuf[128]; \
67-
sprintf( szErrorBuf, info, arg1 ); \
67+
snprintf( szErrorBuf, 128, info, arg1 ); \
6868
RETURN_ERROR( status, szErrorBuf ); \
6969
}
7070

7171

7272
#define RETURN_ERROR2( status, info, arg1, arg2 ) \
7373
{ \
7474
char szErrorBuf[128]; \
75-
sprintf( szErrorBuf, info, arg1, arg2 ); \
75+
snprintf( szErrorBuf, 128, info, arg1, arg2 ); \
7676
RETURN_ERROR( status, szErrorBuf ); \
7777
}
7878

NVPClient/log.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ CybsLogError cybs_prepare_log(config cfg)
9999
char szArchiveName[CYBS_MAX_PATH + 1];
100100

101101
get_formatted_time( ARCHIVE_TIMESTAMP, szFormattedTime );
102-
sprintf(
103-
szArchiveName, "%s.%s", cfg.logFilePath, szFormattedTime );
102+
snprintf(
103+
szArchiveName, sizeof(szArchiveName), "%s.%s", cfg.logFilePath, szFormattedTime );
104104
// TODO: test this, esp. on Linux. Not sure if the new name has to include the path on Linux. On Windows, it doesn't.
105105
if (rename( cfg.logFilePath, szArchiveName ))
106106
{
@@ -487,8 +487,8 @@ void get_formatted_time( const char *szFormat, char *szDest )
487487

488488
SYSTEMTIME time;
489489
GetLocalTime( &time );
490-
sprintf(
491-
szDest, szFormat, time.wYear, time.wMonth, time.wDay,
490+
snprintf(
491+
szDest, sizeof(szDest), szFormat, time.wYear, time.wMonth, time.wDay,
492492
time.wHour, time.wMinute, time.wSecond, time.wMilliseconds );
493493
#else
494494

@@ -501,8 +501,8 @@ void get_formatted_time( const char *szFormat, char *szDest )
501501
functions so this is not an issue. */
502502
loc = localtime( &clock );
503503

504-
sprintf(
505-
szDest, szFormat, loc->tm_year + 1900, loc->tm_mon + 1, loc->tm_mday,
504+
snprintf(
505+
szDest, sizeof(szDest), szFormat, loc->tm_year + 1900, loc->tm_mon + 1, loc->tm_mday,
506506
loc->tm_hour, loc->tm_min, loc->tm_sec );
507507

508508
#endif

XMLClient/XMLClient.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ unsigned long pthreads_thread_id(void );
6868
#define RETURN_ERROR1( status, info, arg1 ) \
6969
{ \
7070
char szErrorBuf[128]; \
71-
sprintf( szErrorBuf, info, arg1 ); \
71+
snprintf( szErrorBuf, 128, info, arg1 ); \
7272
RETURN_ERROR( status, szErrorBuf ); \
7373
}
7474

7575
#define RETURN_ERROR2( status, info, arg1, arg2 ) \
7676
{ \
7777
char szErrorBuf[128]; \
78-
sprintf( szErrorBuf, info, arg1, arg2 ); \
78+
snprintf( szErrorBuf, 128, info, arg1, arg2 ); \
7979
RETURN_ERROR( status, szErrorBuf ); \
8080
}
8181

0 commit comments

Comments
 (0)