Remaining rgagnon source audit improvements (bug #2011)
[asterisk/asterisk.git] / srv.c
diff --git a/srv.c b/srv.c
index 3d70307..6311868 100755 (executable)
--- a/srv.c
+++ b/srv.c
@@ -60,7 +60,7 @@ static int parse_srv(unsigned char *host, int hostlen, int *portno, unsigned cha
        if (res && strcmp(repl, ".")) {
                ast_verbose( VERBOSE_PREFIX_3 "parse_srv: SRV mapped to host %s, port %d\n", repl, ntohs(srv->portnum));
                if (host) {
-                       strncpy(host, repl, hostlen - 2);
+                       strncpy(host, repl, hostlen - 1);
                        host[hostlen-1] = '\0';
                }
                if (portno)
@@ -109,7 +109,7 @@ int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, co
                ret |= ast_autoservice_stop(chan);
 
        if (ret <= 0) {
-               strcpy(host, "");
+               host[0] = '\0';
                *port = -1;
                return ret;
        }