Module: sip-router
Branch: master
Commit: 91f79909c53d3b86d497193a4671699b4ec09782
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=91f7990…
Author: Henning Westerholt <henning.westerholt(a)1und1.de>
Committer: Henning Westerholt <henning.westerholt(a)1und1.de>
Date: Wed Aug 3 17:48:44 2011 +0200
pdbt: off-by-one error fixed in carrier.c, better output for pdbt command-line interface
(parseable)
---
utils/pdbt/carrier.c | 4 ++--
utils/pdbt/pdbt.c | 10 +++++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/utils/pdbt/carrier.c b/utils/pdbt/carrier.c
index 07de4c6..24bfa0a 100644
--- a/utils/pdbt/carrier.c
+++ b/utils/pdbt/carrier.c
@@ -93,8 +93,8 @@ int load_carrier_names(char *filename) {
exit(-1);
}
- strncpy(cnames[id], p, len);
- cnames[id][len]=0;
+ strncpy(cnames[id], p, len - 1);
+ cnames[id][len - 1]=0;
nextline:
n++;
diff --git a/utils/pdbt/pdbt.c b/utils/pdbt/pdbt.c
index 5cc5689..afb9525 100644
--- a/utils/pdbt/pdbt.c
+++ b/utils/pdbt/pdbt.c
@@ -546,10 +546,12 @@ void query_mmap(char *number, char *comment, void *data) {
nmatch=dtm_longest_match(mroot, number, strlen(number), &carrierid);
if (nmatch<=0) {
- LINFO("%s: not_found: nmatch=%ld, comment='%s'\n", number, (long
int)nmatch, comment);
+ LINFO("%s:%s:%ld:%s\n", number, comment, (long int)carrierid, "not
allocated, probably old");
}
else {
- LINFO("%s: found: carrier_id=%ld, carrier_name='%s', nmatch=%ld,
comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid),
(long int)nmatch, comment);
+ LINFO("%s:%s:%ld:%s\n", number, comment, (long int)carrierid,
carrierid2name(carrierid));
+ /* LINFO("%s: found: carrier_id=%ld, carrier_name='%s', nmatch=%ld,
comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid),
(long int)nmatch, comment);
+ */
}
}
@@ -566,7 +568,9 @@ void query_server(char *number, char *comment, void *data) {
LINFO("%s: not_found: comment='%s'\n", number, comment);
}
else {
- LINFO("%s: found: carrier_id=%ld, carrier_name='%s',
comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid),
comment);
+ LINFO("%s:%ld:%s\n", number, (long int)carrierid,
carrierid2name(carrierid));
+ /* LINFO("%s: found: carrier_id=%ld, carrier_name='%s',
comment='%s'\n", number, (long int)carrierid, carrierid2name(carrierid),
comment);
+ */
}
}