]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Sat, 5 Jan 2008 21:47:24 +0000 (21:47 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sat, 5 Jan 2008 21:47:24 +0000 (21:47 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7102 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_utils.c

index 8d9319aa6319811e0c41ee2e81d831f21ae74a40..ce2b02688f73fb32b3ba368148558f3d3e140578 100644 (file)
@@ -70,7 +70,7 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size
        switch_size_t total = 0;
 
        p = buf;
-       while (total + sizeof(c) < len && (cur = read(fd, &c, sizeof(c))) > 0) {
+       while (total + 2 < len && (cur = read(fd, &c, 1)) == 1) {
                total += cur;
                *p++ = c;
                if (c == '\r' || c == '\n') {
@@ -79,6 +79,7 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size
        }
 
        *p++ = '\0';
+       assert(total < len);
        return total;
 }