From: Salva <salva9@gmail.com>
To: netfilter-devel@vger.kernel.org
Subject: can't resize payload
Date: Sun, 31 Jan 2010 19:58:50 +0100 [thread overview]
Message-ID: <651220411001311058u4f61f34alea5a8496beecf01d@mail.gmail.com> (raw)
Hi,
I try to resize the payload of TCP packed but i can't. I don't know if
this is the right way?
This is the part of code:
len = nfq_get_payload(nfa, &full_packet);
struct ip *iphdr = (struct ip *) full_packet;
int iphlen = iphdr->ip_hl<<2;
struct tcphdr *tcp = (struct tcphdr *)((caddr_t )iphdr + iphlen);
unsigned char *pl_data = (void *)tcp + (tcp->doff*4)+32;
...
pl_data = realloc(pl_data, (strlen((char *)pl_data) ) +
(sizeof(char) * strlen(m))+1 );
...
This part of code works only sometimes and some others fails with
invalid pointer
Can i use realloc to allocate more memory in this case?
How can i allocate more memory for the payload?
I don't know if is the correct mailing list for this kind of questions?
If not, there's another list available?
Salva
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2010-01-31 18:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=651220411001311058u4f61f34alea5a8496beecf01d@mail.gmail.com \
--to=salva9@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).