Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Getting BUSERROR, and I don't know why!


  • Please log in to reply
3 replies to this topic

#1 toto_7

toto_7

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 244 posts

Posted 19 November 2011 - 04:23 AM

Hello,

Trying to create a project that access a pcap file and prints ETH add, IP add and TCP/UDP. For a reason when I'm doing...
int ether_type = ((int)(pkt_pointer[12]) << 8) | (int)pkt_pointer[13];
		
		if(ether_type == ETHERTYPE_IP)
			offset = 14;
		else 
			offset = ?;
		
		pkt_pointer += offset;
Getting BUS ERROR. I know that error happening on the last line, but can't solve it. Any idea? Also, how many will be the offset in the else statement? Else refer to ETHETYPE_ARP.

Thank you
  • 0

"Programming is like **. One mistake and you have to support it for the rest of your life."

-Michael Sinz

#2 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 20 November 2011 - 06:50 PM

Where are you getting this BUS ERROR thing from?
  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'


#3 RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1311 posts
  • Location:C:\Countries\US
  • Programming Language:C, Java, C++, PHP, Python, JavaScript

Posted 20 November 2011 - 06:53 PM

What does the question mark ('?') on line 6 mean?
  • 0

#4 dargueta

dargueta

    I chown trolls.

  • Moderator
  • 4854 posts
  • Programming Language:C, Java, C++, PHP, Python, JavaScript, Perl, Assembly, Bash, Others
  • Learning:Objective-C

Posted 20 November 2011 - 06:56 PM

Good catch, I didn't even see that. That shouldn't even compile.
  • 0

sudo rm -rf / && echo $'Sanitize your inputs!'





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download