Is it possible to add trailing zero to the m_IBuffer field?

Home Forums Discussions Support Is it possible to add trailing zero to the m_IBuffer field?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4976
    alexey_
    Participant

      Hello!

      Is it possible to add a trailing zero to the INTERMEDIATE_BUFFER::m_IBuffer field from common.h for WinpktFilter program? The reason I need it is that I’m doing quite extensive parsing of the HTTP packets.. and I don’t want to copy every packet’s content just to parse it. So I’m using standard library functions like strstr and so on directly on (Packet.m_IBuffer + some_offset) field. They need NULL-terminated string as input. m_IBuffer is not NULL-terminated. So in order to solve this problem I simply wrote like this:

      struct _INTERMEDIATE_BUFFER
      {
      ……..
      UCHAR m_IBuffer [MAX_ETHER_FRAME + 1];
      } INTERMEDIATE_BUFFER, *PINTERMEDIATE_BUFFER;

      and added one more line like this:

      while(api.ReadPacket(&Request))
      {
      PacketBuffer.m_IBuffer[PacketBuffer.m_Length] = 0;
      ……
      }

      So my question is – is it safe? It works so far… but I just want to ask the developer 😉 May be you are making some assumptions about INTERMEDIATE_BUFFER deep inside the driver?.. Or you can give me some other ways to solve my problem?

      Thanks a lot in advance,

      Alexey

      #5891
      Vadim Smirnov
      Keymaster

        It is safe, you pass the larger buffer to the driver but it ignores the additional bytes in the trail.

      Viewing 2 posts - 1 through 2 (of 2 total)
      • You must be logged in to reply to this topic.