Posts by user37361 • 327 points
16 posts
-
1
votes2
answers308
viewsQ: Bit array in c doubt
People were looking at some examples of bit array and saw the following function: char get_bit(char *array, int index) { return 1 & (array[index / 8] >> (index % 8)); } I couldn’t…
-
-4
votes2
answers76
viewsQ: Strict Aliasing do c
Guys I would like someone to explain me this such Strict Aliasing , and with cast examples , I saw in a book more did not understand right.
-
0
votes0
answers875
viewsQ: Chat using different networks
I’ve been chatting on python , and when I test locally, the chat works, but when I test on networks that are in different places, it doesn’t work, example server on my computer and client on a…
-
0
votes1
answer124
viewsQ: Doubt replace javascript function
Anyone can explain to me what these parameters mean within the function replace (/</g) , (http:\/\/\S+)/g function escape(s) { var text = s.replace(/</g, '<').replace('"',…
-
5
votes1
answer100
viewsQ: Doubt exercise of xss
Guys wanted to understand the following logic of an xss challenge they were doing So because when I put <script>alert(1);</script> does not work but when I put…
-
1
votes1
answer50
viewsQ: SQL query doubt
Guys , I saw the following expression in a sql video: (union select 1,2,3 ) What does it mean ? video link: https://www.youtube.com/watch?v=N0zAChmZIZU…
-
-1
votes1
answer209
viewsQ: Http server in c
Gelera would like to understand this line of code: complete code: https://dzone.com/articles/web-server-c if (strncmp(request, "GET ", 4) == 0) { ptr = request + 4; } Why add + 4 ?…
-
0
votes1
answer30
viewsQ: Checksum ip Packet
Guys would like to understand the 4 last lines , why do all these bitswise? Code complete. Follows the code: static int in_cksum(u_short *addr, int len) { register int nleft = len; register u_short…
-
3
votes1
answer107
views -
4
votes2
answers108
viewsQ: Cast in sockets
Guys wanted to understand what the reason of doing these cast below is just by aesthetics? What does it really affect in the code? struct iphdr *ip; char *buffer ip = (struct iphdr*) packet; icmp =…
-
2
votes1
answer53
viewsQ: Client http socket in c
People would like someone to explain to me the following code snippet of an http client does, mainly this expression on while(sent < strlen(get)), the complete code is found at this link. int…
-
2
votes0
answers60
viewsQ: Linux Sockets - Doubt
Why use these functions with socket implementations and what they serve? select() FD_SET() FD_CLR() FD_ZERO()
-
2
votes1
answer148
viewsQ: Doubt typedef void*
You guys, I’m watching the next show: typedef void* type_t; so I was doing some tests and I put type_t in a sizeof and it returned me 4 bytes more size as well ?…
-
1
votes1
answer146
viewsQ: Struct pointer cast doubt
I can’t understand the meaning of this cast: the function will execute and returns a type type_t, which is a typedef for void*. Then is made a cast for header_t*, which is a struct, but I can’t…
-
6
votes1
answer123
viewsQ: Why can I access a structure without the pointer?
When I declare a pointer to struct I can access members without entering an address struct, why is it possible? For example: struct exemplo{ int a ; }; int main() { struct exemplo *p; p->a = 10 ;…
-
2
votes0
answers48
viewsQ: Virtual memory using bitset algorithms
I’m seeing the following macros that take as parameters how many frames (virtual memory) ram memory may have, but I can’t understand its meaning: define INDEX_FROM_BIT(a) (a/(8*4)) define…