]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 77942 via svnmerge from
authorSteve Murphy <murf@digium.com>
Thu, 2 Aug 2007 18:21:40 +0000 (18:21 +0000)
committerSteve Murphy <murf@digium.com>
Thu, 2 Aug 2007 18:21:40 +0000 (18:21 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r77942 | murf | 2007-08-02 11:56:37 -0600 (Thu, 02 Aug 2007) | 1 line

This patch hopefully solves 10141; The user is running with it, and it doesn't appear to harm asterisk's operation, and may prevent a crash. I'll store it in 1.2, as we have shut down support on 1.2, but since I developed the patch before support finished, and it might affect 1.4 and trunk, I'm going ahead with it.
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@77945 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/fskmodem.c

index 9bbb2203f468b9551a2efa9a5fbdace89481c67a..3ab462886f67794bf640d3d7d5be830d9e20978f 100644 (file)
@@ -188,6 +188,9 @@ int fsk_serie(fsk_data *fskd, short *buffer, int *len, int *outbyte)
        int i,j,n1,r;
        int samples=0;
        int olen;
+       int beginlen=*len;
+       int beginlenx;
+       
        switch(fskd->state) {
                /* Pick up where we left off */
        case STATE_SEARCH_STARTBIT2:
@@ -215,12 +218,13 @@ of a transmission (what a LOSING design), we cant do it this elegantly */
 beginning of a start bit in the TDD sceanario. It just looks for sufficient
 level to maybe, perhaps, guess, maybe that its maybe the beginning of
 a start bit, perhaps. This whole thing stinks! */
+               beginlenx=beginlen; /* just to avoid unused war warnings */
                if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1);
                samples++;
                for(;;)
                   {
 search_startbit2:                 
-                       if (!*len) {
+                       if (*len <= 0) {
                                fskd->state = STATE_SEARCH_STARTBIT2;
                                return 0;
                        }
@@ -238,7 +242,7 @@ search_startbit3:
                        fskd->state = STATE_SEARCH_STARTBIT3;
                        return 0;
                }
-               for(;i;i--) { if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1); 
+               for(;i>0;i--) { if (demodulador(fskd,&fskd->x1,GET_SAMPLE)) return(-1); 
 #if 0
                        printf("x1 = %5.5f ", fskd->x1);
 #endif