Skip to content

Commit

Permalink
printf security
Browse files Browse the repository at this point in the history
  • Loading branch information
Siguza committed Jun 15, 2021
1 parent db01c5d commit 8224af1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/include/pongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ struct pongo_exports {
void * value;
};

extern void panic(const char* string);
extern _Noreturn __attribute__((format(printf, 1, 2))) void panic(const char* string, ...);
extern void spin(uint32_t usec);
extern uint64_t get_ticks();
extern void usleep(uint32_t usec);
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ uint64_t alloc_phys(uint32_t size) {
}
}
if (!found) panic("alloc_phys: OOM");
if (!rv) panic("alloc_phys: returning NULL?? (size %llx, npages %llx, found_pages %llx)", size, npages, found_pages);
if (!rv) panic("alloc_phys: returning NULL?? (size 0x%x, npages 0x%x, found_pages 0x%x)", size, npages, found_pages);
phys_unlink_contiguous(rv, size);
phys_reference(rv, size);
enable_interrupts();
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/pongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ extern void task_irq_dispatch(uint32_t intr);
extern void task_yield_asserted();
extern void task_register_unlinked(struct task* task, void (*entry)());
extern void task_suspend_self();
extern _Noreturn void panic(const char* string, ...);
extern _Noreturn __attribute__((format(printf, 1, 2))) void panic(const char* string, ...);
extern void pmgr_reset();
extern void spin(uint32_t usec);
extern void task_set_sched_head(struct task* task);
Expand Down
2 changes: 1 addition & 1 deletion src/shell/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ void panic_cmd(const char* cmd, char* args) {
if (! *args) {
panic("panic called from shell");
} else {
panic(args);
panic("%s", args);
}
}

Expand Down

0 comments on commit 8224af1

Please sign in to comment.