Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
927ec9c7
Commit
927ec9c7
authored
11 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
sscanf() bug fixes from David Sidrane
parent
662622b5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libc/stdio/lib_sscanf.c
+18
-4
18 additions, 4 deletions
libc/stdio/lib_sscanf.c
with
18 additions
and
4 deletions
libc/stdio/lib_sscanf.c
+
18
−
4
View file @
927ec9c7
...
...
@@ -51,11 +51,19 @@
#include
<debug.h>
/****************************************************************************
* Definitions
*
Pre-processor
Definitions
****************************************************************************/
#define MAXLN 128
#ifndef MIN
# define MIN(a,b) (a < b ? a : b)
#endif
#ifndef MAX
# define MAX(a,b) (a > b ? a : b)
#endif
/****************************************************************************
* Private Type Declarations
****************************************************************************/
...
...
@@ -287,14 +295,19 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
{
/* No... Guess a field width using some heuristics */
width
=
findwidth
(
buf
,
fmt
);
int
tmpwidth
=
findwidth
(
buf
,
fmt
);
width
=
MIN
(
sizeof
(
tmp
)
-
1
,
tmpwidth
);
}
/* Copy the string (if we are making an assignment) */
if
(
!
noassign
)
{
strncpy
(
tv
,
buf
,
width
);
if
(
width
>
0
)
{
strncpy
(
tv
,
buf
,
width
);
}
tv
[
width
]
=
'\0'
;
}
...
...
@@ -425,7 +438,8 @@ int vsscanf(FAR const char *buf, FAR const char *fmt, va_list ap)
{
/* No... Guess a field width using some heuristics */
width
=
findwidth
(
buf
,
fmt
);
int
tmpwidth
=
findwidth
(
buf
,
fmt
)
width
=
MIN
(
sizeof
(
tmp
)
-
1
,
tmpwidth
);
}
/* Copy the numeric string into a temporary working
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment