projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c9f6acf
)
fix possible nullpointer dereferenciation; tnx to the clang static analyzer
author
Wilfried Goesgens
<dothebart@citadel.org>
Fri, 25 May 2012 10:22:57 +0000
(12:22 +0200)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Fri, 25 May 2012 10:22:57 +0000
(12:22 +0200)
citadel/locate_host.c
patch
|
blob
|
history
diff --git
a/citadel/locate_host.c
b/citadel/locate_host.c
index fa8cfad2f0f3d0bccd75e3e6d2ecb2fce1150ec9..39309e943c6dd7b8ab5f30d276395bbc08366cd5 100644
(file)
--- a/
citadel/locate_host.c
+++ b/
citadel/locate_host.c
@@
-146,7
+146,7
@@
int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
if( len == -1 ) {
if (txtbuf != NULL) {
snprintf(txtbuf, txtbufsize,
if( len == -1 ) {
if (txtbuf != NULL) {
snprintf(txtbuf, txtbufsize,
- "Message rejected due to known spammer source IP address");
+
"Message rejected due to known spammer source IP address");
}
if (need_to_free_answer) free(answer);
return(1);
}
if (need_to_free_answer) free(answer);
return(1);
@@
-184,7
+184,7
@@
int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
{
if (txtbuf != NULL) {
snprintf(txtbuf, txtbufsize,
{
if (txtbuf != NULL) {
snprintf(txtbuf, txtbufsize,
- "Message rejected due to known spammer source IP address");
+
"Message rejected due to known spammer source IP address");
}
if (need_to_free_answer) free(answer);
free(result);
}
if (need_to_free_answer) free(answer);
free(result);
@@
-235,11
+235,17
@@
int rblcheck_backend(char *domain, char *txtbuf, int txtbufsize) {
}
*rp = '\0';
if (txtbuf != NULL) {
}
*rp = '\0';
if (txtbuf != NULL) {
- snprintf(txtbuf, txtbufsize, "%s", result);
- }
- /* Remove nonprintable characters */
- for (p=txtbuf; *p; ++p) {
- if (!isprint(*p)) strcpy(p, p+1);
+ long len;
+ len = snprintf(txtbuf, txtbufsize, "%s", result);
+
+ /* Remove nonprintable characters */
+ for (p = txtbuf; *p != '\0'; p++) {
+ if (!isprint(*p)) {
+ memmove (p,
+ p + 1,
+ len - (p - txtbuf) - 1);
+ }
+ }
}
if (need_to_free_answer) free(answer);
free(result);
}
if (need_to_free_answer) free(answer);
free(result);