Skip to content

Commit

Permalink
db_text: avoid buffer overflow for large names and/or values in db_te…
Browse files Browse the repository at this point in the history
…xt files

(cherry picked from commit 9d7ac44)
  • Loading branch information
ovidiusas committed May 13, 2019
1 parent 0357a63 commit 1bb9381
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/db_text/dbt_file.c
Expand Up @@ -168,6 +168,11 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn)
if(c==EOF)
goto clean;
buf[bp++] = c;
if (bp==4096) {
LM_ERR("Buffer overflow for file [%s] row=[%d] col=[%d] c=[%c]."
" Required buffer size greater then 4096!\n",
path, crow+1, ccol+1, c);
}
c = fgetc(fin);
}
colp = dbt_column_new(buf, bp);
Expand Down Expand Up @@ -459,6 +464,11 @@ dbt_table_p dbt_load_file(const str *tbn, const str *dbn)
}
}
buf[bp++] = c;
if (bp==4096) {
LM_ERR("Buffer overflow for file [%s] row=[%d] col=[%d] c=[%c]."
" Required buffer size greater then 4096!\n",
path, crow+1, ccol+1, c);
}
c = fgetc(fin);
}
dtval.val.str_val.s = buf;
Expand Down

0 comments on commit 1bb9381

Please sign in to comment.