Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9fe89939
Commit
9fe89939
authored
Nov 11, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basestring_vsnprintf fix for size==0
parent
3048dc0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
6 deletions
+24
-6
ndb/src/common/util/basestring_vsnprintf.c
ndb/src/common/util/basestring_vsnprintf.c
+24
-6
No files found.
ndb/src/common/util/basestring_vsnprintf.c
View file @
9fe89939
...
...
@@ -20,6 +20,10 @@
#include <basestring_vsnprintf.h>
#include <my_config.h>
/*
#define SNPRINTF_RETURN_TRUNC
*/
int
basestring_snprintf
(
char
*
str
,
size_t
size
,
const
char
*
format
,
...)
{
...
...
@@ -47,13 +51,27 @@ static char basestring_vsnprintf_buf[16*1024];
int
basestring_vsnprintf
(
char
*
str
,
size_t
size
,
const
char
*
format
,
va_list
ap
)
{
if
(
size
==
0
)
{
#ifdef SNPRINTF_RETURN_TRUNC
return
BASESTRING_VSNPRINTF_FUNC
(
basestring_vsnprintf_buf
,
sizeof
(
basestring_vsnprintf_buf
),
format
,
ap
);
#else
char
buf
[
1
];
return
BASESTRING_VSNPRINTF_FUNC
(
buf
,
1
,
format
,
ap
);
#endif
}
{
int
ret
=
BASESTRING_VSNPRINTF_FUNC
(
str
,
size
,
format
,
ap
);
#ifdef SNPRINTF_RETURN_TRUNC
if
(
ret
==
size
-
1
||
ret
==
-
1
)
{
if
(
ret
==
size
-
1
||
ret
==
-
1
)
{
ret
=
BASESTRING_VSNPRINTF_FUNC
(
basestring_vsnprintf_buf
,
sizeof
(
basestring_vsnprintf_buf
),
format
,
ap
);
}
#endif
return
ret
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment