Changeset 339 in ntrip


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

fixed illegal zero byte

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ntripclient/NtripLinuxClient.c

    r326 r339  
    11/*
    22  Easy example NTRIP client for Linux/Unix.
    3   $Id: NtripLinuxClient.c,v 1.21 2006/07/18 08:55:30 stoecker Exp $
     3  $Id: NtripLinuxClient.c,v 1.22 2006/11/23 14:39:50 stoecker Exp $
    44  Copyright (C) 2003-2005 by Dirk Stoecker <soft@dstoecker.de>
    55   
     
    4141
    4242/* CVS revision and version */
    43 static char revisionstr[] = "$Revision: 1.21 $";
    44 static char datestr[]     = "$Date: 2006/07/18 08:55:30 $";
     43static char revisionstr[] = "$Revision: 1.22 $";
     44static char datestr[]     = "$Date: 2006/11/23 14:39:50 $";
    4545
    4646struct Args
     
    348348        exit(1);
    349349      }
    350       i += encode(buf+i, MAXDATASIZE-i-5, args.user, args.password);
    351       if(i > MAXDATASIZE-5)
     350      i += encode(buf+i, MAXDATASIZE-i-4, args.user, args.password);
     351      if(i > MAXDATASIZE-4)
    352352      {
    353353        fprintf(stderr, "Username and/or password too long\n");
    354354        exit(1);
    355355      }
    356       snprintf(buf+i, 5, "\r\n\r\n");
    357       i += 5;
     356      buf[i++] = '\r';
     357      buf[i++] = '\n';
     358      buf[i++] = '\r';
     359      buf[i++] = '\n';
    358360    }
    359361    if(send(sockfd, buf, (size_t)i, 0) != i)
  • 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    {
  • trunk/rtcm3torinex/rtcm3torinex.c

    r328 r339  
    11/*
    22  Converter for RTCM3 data to RINEX.
    3   $Id: rtcm3torinex.c,v 1.12 2006/11/23 14:39:50 stoecker Exp $
     3  $Id: rtcm3torinex.c,v 1.13 2006/11/24 09:53:42 stoecker Exp $
    44  Copyright (C) 2005-2006 by Dirk Stoecker <stoecker@euronik.eu>
    55
     
    5151
    5252/* CVS revision and version */
    53 static char revisionstr[] = "$Revision: 1.12 $";
     53static char revisionstr[] = "$Revision: 1.13 $";
    5454
    5555static uint32_t CRC24(long size, const unsigned char *buf)
     
    990990
    991991#ifndef NO_RTCM3_MAIN
    992 static char datestr[]     = "$Date: 2006/11/23 14:39:50 $";
     992static char datestr[]     = "$Date: 2006/11/24 09:53:42 $";
    993993
    994994/* The string, which is send as agent in HTTP request */
     
    13341334        exit(1);
    13351335      }
    1336       i += encode(buf+i, MAXDATASIZE-i-5, args.user, args.password);
    1337       if(i > MAXDATASIZE-5)
     1336      i += encode(buf+i, MAXDATASIZE-i-4, args.user, args.password);
     1337      if(i > MAXDATASIZE-4)
    13381338      {
    13391339        RTCM3Error("Username and/or password too long\n");
    13401340        exit(1);
    13411341      }
    1342       snprintf(buf+i, 5, "\r\n\r\n");
    1343       i += 5;
     1342      buf[i++] = '\r';
     1343      buf[i++] = '\n';
     1344      buf[i++] = '\r';
     1345      buf[i++] = '\n';
    13441346    }
    13451347    if(send(sockfd, buf, (size_t)i, 0) != i)
Note: See TracChangeset for help on using the changeset viewer.