Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
c7f2cd7f
Commit
c7f2cd7f
authored
Jul 04, 2012
by
Paul Eggert
Browse files
* doprnt.c (doprnt): Don't assume string length fits in 'int'.
Tighten new eassert a bit.
parent
8ce70ed2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
+9
-4
src/ChangeLog
src/ChangeLog
+5
-0
src/doprnt.c
src/doprnt.c
+4
-4
No files found.
src/ChangeLog
View file @
c7f2cd7f
2012-07-04 Paul Eggert <eggert@cs.ucla.edu>
* doprnt.c (doprnt): Don't assume string length fits in 'int'.
Tighten new eassert a bit.
2012-07-04 Dmitry Antipov <dmantipov@yandex.ru>
Fix compilation with --enable-gcc-warnings and -O1
...
...
src/doprnt.c
View file @
c7f2cd7f
...
...
@@ -135,8 +135,8 @@ ptrdiff_t
doprnt
(
char
*
buffer
,
ptrdiff_t
bufsize
,
const
char
*
format
,
const
char
*
format_end
,
va_list
ap
)
{
const
char
*
fmt
=
format
;
/* Pointer into format string */
register
char
*
bufptr
=
buffer
;
/* Pointer into output buffer.
.
*/
const
char
*
fmt
=
format
;
/* Pointer into format string
.
*/
char
*
bufptr
=
buffer
;
/* Pointer into output buffer.
*/
/* Use this for sprintf unless we need something really big. */
char
tembuf
[
DBL_MAX_10_EXP
+
100
];
...
...
@@ -150,7 +150,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
/* Buffer we have got with malloc. */
char
*
big_buffer
=
NULL
;
register
in
t
tem
=
-
1
;
ptrdiff_
t
tem
=
-
1
;
char
*
string
;
char
fixed_buffer
[
20
];
/* Default buffer for small formatting. */
char
*
fmtcpy
;
...
...
@@ -368,7 +368,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
/* Copy string into final output, truncating if no room. */
doit:
eassert
(
tem
!=
-
1
);
eassert
(
0
<=
tem
);
/* Coming here means STRING contains ASCII only. */
if
(
STRING_BYTES_BOUND
<
tem
)
error
(
"Format width or precision too large"
);
...
...
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