projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use offset into parser buffer to avoid potential heap overflow.
[project/uci.git]
/
util.c
diff --git
a/util.c
b/util.c
index
ce7d849
..
09f1817
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-89,9
+89,12
@@
bool uci_validate_text(const char *str)
{
while (*str) {
unsigned char c = *str;
{
while (*str) {
unsigned char c = *str;
- if ((c == '\r') || (c == '\n') ||
- ((c < 32) && (c != '\t')))
+ if (((c < 32) &&
+ (c != '\t') &&
+ (c != '\n') &&
+ (c != '\r'))) {
return false;
return false;
+ }
str++;
}
return true;
str++;
}
return true;
@@
-161,12
+164,12
@@
error:
}
}
-__private void uci_parse_error(struct uci_context *ctx, char *
pos, char *
reason)
+__private void uci_parse_error(struct uci_context *ctx, char *reason)
{
struct uci_parse_context *pctx = ctx->pctx;
pctx->reason = reason;
{
struct uci_parse_context *pctx = ctx->pctx;
pctx->reason = reason;
- pctx->byte = p
os - pctx->buf
;
+ pctx->byte = p
ctx_pos(pctx)
;
UCI_THROW(ctx, UCI_ERR_PARSE);
}
UCI_THROW(ctx, UCI_ERR_PARSE);
}