projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sessiond: main.cpp: iterate on list using list_iteration_adapter
[lttng-tools.git]
/
src
/
common
/
ini-config
/
ini.cpp
diff --git
a/src/common/ini-config/ini.cpp
b/src/common/ini-config/ini.cpp
index 978b185fac98073f6e5beccdb952822cc301d183..e6fba384e3ed967c6e0c6e83adcd13445214f216 100644
(file)
--- a/
src/common/ini-config/ini.cpp
+++ b/
src/common/ini-config/ini.cpp
@@
-75,7
+75,7
@@
static char *find_char_or_comment(const char *s, char c)
{
int was_whitespace = 0;
{
int was_whitespace = 0;
- while (*s && *s != c &&
!(was_whitespace && *s =
= ';')) {
+ while (*s && *s != c &&
(!was_whitespace || *s !
= ';')) {
was_whitespace = isspace((unsigned char) (*s));
s++;
}
was_whitespace = isspace((unsigned char) (*s));
s++;
}
@@
-117,7
+117,7
@@
int ini_parse_file(FILE *file, ini_entry_handler handler, void *user)
#endif
/* Scan through file line by line */
#endif
/* Scan through file line by line */
- while (fgets(line, INI_MAX_LINE, file) !=
NULL
) {
+ while (fgets(line, INI_MAX_LINE, file) !=
nullptr
) {
lineno++;
start = line;
lineno++;
start = line;
@@
-178,6
+178,10
@@
int ini_parse_file(FILE *file, ini_entry_handler handler, void *user)
* Valid name[=:]value pair found, call
* handler
*/
* Valid name[=:]value pair found, call
* handler
*/
+ if (strlen(name) >= sizeof(prev_name)) {
+ /* Truncation occurs, report an error. */
+ error = lineno;
+ }
strncpy0(prev_name, name, sizeof(prev_name));
if (handler(user, section, name, value) < 0 && !error) {
error = lineno;
strncpy0(prev_name, name, sizeof(prev_name));
if (handler(user, section, name, value) < 0 && !error) {
error = lineno;
This page took
0.023021 seconds
and
4
git commands to generate.