Changeset 339 in ntrip for trunk/ntripserver


Ignore:
Timestamp:
Nov 29, 2006, 11:43:15 AM (15 years ago)
Author:
stoecker
Message:

fixed illegal zero byte

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripserver/NtripLinuxServer.c

    r326 r339  
    4141 */
    4242
    43 /* $Id: NtripLinuxServer.c,v 1.23 2006/08/16 08:33:04 stoecker Exp $
     43/* $Id: NtripLinuxServer.c,v 1.24 2006/11/23 14:39:50 stoecker Exp $
    4444 * Changes - Version 0.7
    4545 * Sep 22 2003  Steffen Tschirpke <St.Tschirpke@actina.de>
     
    463463          }
    464464          nBufferBytes += encode(szSendBuffer+nBufferBytes,
    465             sizeof(szSendBuffer)-nBufferBytes-5, stream_user, stream_password);
    466           if(nBufferBytes > (int)sizeof(szSendBuffer)-5)
     465            sizeof(szSendBuffer)-nBufferBytes-4, stream_user, stream_password);
     466          if(nBufferBytes > (int)sizeof(szSendBuffer)-4)
    467467          {
    468468            fprintf(stderr, "Username and/or password too long\n");
    469469            exit(1);
    470470          }
    471           snprintf(szSendBuffer+nBufferBytes, 5, "\r\n\r\n");
    472           nBufferBytes += 5;
     471          szSendBuffer[nBufferBytes++] = '\r';
     472          szSendBuffer[nBufferBytes++] = '\n';
     473          szSendBuffer[nBufferBytes++] = '\r';
     474          szSendBuffer[nBufferBytes++] = '\n';
    473475        }
    474476        else
     
    624626      sizeof(const char *));
    625627    /* send message to caster */
    626     szSendBuffer[0] = '\0';
    627     sprintf(szSendBuffer, "SOURCE %s /%s\r\n", password, mountpoint);
    628     strcat(szSendBuffer, "Source-Agent: ");
    629     strcat(szSendBuffer, VERSION);
    630     strcat(szSendBuffer, "\r\n");
    631     strcat(szSendBuffer, "\r\n");
    632     strcat(szSendBuffer, "\0");
    633     nBufferBytes = strlen(szSendBuffer);
     628    nBufferBytes = sprintf(szSendBuffer, "SOURCE %s /%s\r\nSource-Agent: "
     629    VERSION "\r\n\r\n", password, mountpoint);
    634630    if((send(sock_id, szSendBuffer, (size_t)nBufferBytes, 0)) != nBufferBytes)
    635631    {
Note: See TracChangeset for help on using the changeset viewer.