Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7840093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:39:22+00:00 2026-06-02T15:39:22+00:00

please look at the code snippet char ipAddr[] = {192, 168, 88, 2}; struct

  • 0

please look at the code snippet

char ipAddr[] = {192, 168, 88, 2};
struct iphdr *ip_hdr = (struct iphdr*)(some_valid_eth_hdr_pointer + 1);
if (0 == memcmp((void*)(ip_hdr->saddr), (void*)ipAddr, 4)) /*memcmp cause my whole system crashed*/
{
    printk("ip source addr matched\n");
}

the code is extracted from a linux netfilter hook function, which means the ip_hdr->saddr may belongs to the kernel space memory, and i am pretty sure the ip_hdr points to valid memory. still dont know what the problem is, so please help me out.

thanks in advance !

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:39:25+00:00Added an answer on June 2, 2026 at 3:39 pm

    Well, here’s your problem:

    memcmp((void*)(ip_hdr->saddr), ...
    

    This interprets the source IP address as a pointer. What you wanted to do was this:

    memcmp(&ip_hdr->saddr, ...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please take a look at the code snippet below: interface IFoo<E>{ void doFoo(E env);
Please look at the below code snippet and let me know how the out
Please look at this code: @interface myObject:NSObject -(void)function:(id)param; @end @implementation myObject -(void)function:(id)param { NSLog(@BEFORE);
Please look through the following code snippet - HTML <div class=aclass> <h1>This is heading
Have a look at the following code snippet... File1.h void somefunc(int); File1.c #include File1.h
Please look at the code below. void func() { for(;;) { var item =
Please look at the following code snippet. I'm getting a nullreferenceexception at this.directories.Add(new directory(s));.
Please take a look at the code snippet below. I want the 2nd MongoDB
please look at the code below. class Program { static void Main(string[] args) {
Please look at this code: def chop(array, search): lo = 0 high = len(array)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.