memory-address

How do you use scanf to get an int in C?

点点圈 提交于 2021-02-04 20:38:07
问题 I'm trying to learn the benefits and shortcomings of different ways to get input from the console. I'm confused with scanf . Why do I need to use use &favNumber instead of favNumber ? I understand that &favNumber is the address location of favNumber , but why is it done this way? I feel like there's a type mismatch here where favNumber is an int and I'm telling scanf that it's a pointer to an int. I thought I wrapped my head around pointers but this is confusing me a bit. Any help would be

Where is the specific address definition of the GPIO IDR register by STM32Cube resulting files?

我是研究僧i 提交于 2021-01-29 11:02:01
问题 I have read through the explanation of the STM32 project produced by the STM32Cube as in this website. From this website, I have learned that: In the stm32f0xx.h file, for example, the origianl address of GPIOA is already declared by "#define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000U)" then all the corresponding registers for GPIOA is declared by "#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)" By the information above, this head file has already defined the original adress of GPIOA, and declared

What will be the size of pointer on a 8 bit microcontroller like 8051?

陌路散爱 提交于 2021-01-29 02:47:26
问题 We know that size of the pointer depends on address bus,so what will be the size of pointer on 8 bit microcontroller like 8051? 回答1: The 8051 is not a C friendly processor. It has several address spaces. I used the Keil 8051 compiler extensively and it had several pointer types. An 8 bit pointer to point at the internal memory space or internal indirect space. A 16 bit pointer to point to either external ram or code space. A "smart" 24 bit pointer that could point anywhere. Basically a tag

How to get process's base address with MODULEENTRY32?

谁说我不能喝 提交于 2021-01-28 22:17:30
问题 I'm looking to do something in this example: Python - How to get the start/base address of a process?. I'm having the same issue as the person in that topic, in that the pointers cheat engine provides is in reference to the base address of the process itself. I've looked around and it looks like the best solution is to use ctypes and the MODULEENTRY32 to store snapshots of processes and analyze their modBaseAddr. Here is my current code import os.path, ctypes, ctypes.wintypes from ctypes

Square Brackets ? why are these used in LEA?

喜你入骨 提交于 2021-01-24 08:18:13
问题 In assmebly the square brackets seem to have the same meaning as * in C. They are used to dereference a pointer. Dereferencing a pointer means going to refer to a specific memory location to read or write it. So it is quite logical to use square brackets in the case of a MOV. But what is the logical reason why they also use it for LEA. LEA EAX, [EBP -4], looks like dereferencing a pointer, ebp - 4, to refer to the pointed memory location but it will not read the value contained in the

Buffer overflow Attack (The Attack Lab phase 2)

六月ゝ 毕业季﹏ 提交于 2020-12-09 08:37:25
问题 I have a buffer overflow lab I have to do for a project called The Attack Lab. I'm on phase 2 of the lab, and I have to inject code as part of my exploit string in order to make the program point to the address of the function touch2(). I've gotten to the point where the output says that its a valid solution for phase 2, but then it says I caused a seg fault and then says I failed the phase. This is the error message I receive cookie: 0x2d6fc2d5 Type string:Touch2!: You called touch2