Share Pastebin
Guest
Public paste!

JD

By: a guest | Dec 6th, 2008 | Syntax: C++ | Size: 1.35 KB | Hits: 38 | Expires: Never
Copy text to clipboard
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <iostream>
  5.  
  6. #include "options.h"
  7.  
  8. void ProcessPacket(char *pkt){
  9.     char *buff;
  10.     buff = "";
  11.     int c = 0;
  12.     int arg = 1;
  13.     for(int i = 0; i < static_cast<signed int>(strlen(pkt)); i++){
  14.         if(static_cast<int>(pkt[i]) != 37){
  15.             buff[c] = pkt[i]; // This line causes a crash. WHY? D: ////////////////////////////////////////////////////////////////
  16.             c++;
  17.         }else{
  18.             if(buff != ""){
  19.                 switch(arg){
  20.                     case 1:
  21.                         if(buff != "xt"){
  22.                             return;
  23.                             break;
  24.                         }
  25.  
  26.                     case 2:
  27.                         if(buff != "zone_master_xt"){
  28.                             return;
  29.                             break;
  30.                         }
  31.  
  32.                     case 3:
  33.                         // OSNAP PROCESSIN IT
  34.                         break;
  35.  
  36.                     default:
  37.                         // OSNAP MOAR PROCESSIN IT
  38.                         break;
  39.  
  40.                 }
  41.                 arg++;
  42.                 buff = "";
  43.                 c = 0;
  44.                 std::cout << buff << "\n";
  45.             }
  46.         }
  47.     }
  48.     std::cout << "\nProcessed Packet: " << pkt << "\n";
  49.  
  50.     return;
  51. }