b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
30 lines
626 B
C
30 lines
626 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int main(void) {
|
|
char dst[20];
|
|
|
|
strcpy(dst, "strcpy works!");
|
|
puts(dst);
|
|
strncpy(dst, "strncpy works!", 20);
|
|
puts(dst);
|
|
|
|
// Make sure no NUL is placed
|
|
memset(dst, 'a', 20);
|
|
dst[19] = 0;
|
|
strncpy(dst, "strncpy should work here too", 10);
|
|
puts(dst);
|
|
|
|
// The string should be properly terminated regardless
|
|
char ndst[28];
|
|
|
|
size_t r = strlcpy(ndst, "strlcpy works!", 28);
|
|
puts(ndst);
|
|
printf("copied %lu\n", r);
|
|
r = strlcat(ndst, " and strlcat!", 28);
|
|
puts(ndst);
|
|
printf("copied %lu\n", r);
|
|
}
|