79658190

Date: 2025-06-08 22:09:28
Score: 1
Natty:
Report link
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/shm.h>

#define SIZE 1
#define KEY 1234

int main() {
    int id = shmget(KEY, SIZE, 0666 | IPC_CREAT);
    if (id == -1) 

    char* ptr = (char*) shmat(id, NULL, 0);
    if (ptr == (char*)(-1));

    while (1) {
        strcpy(ptr, "1234");
        
        strcpy(ptr, "4321");
        
    }
    
    shmctl(id, IPC_RMID, NULL);
}
Reasons:
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user30752381