Code:
From 807b2d6cefff45bf708772c611bcf5014db63898 Mon Sep 17 00:00:00 2001From: Extrems <metaradil@gmail.com>Date: Tue, 18 Apr 2023 21:32:35 -0400Subject: [PATCH 2/2] Use gettimeofday for NULL times--- libgloss/libsysbase/utime.c | 4 ++++ 1 file changed, 4 insertions(+)diff --git a/libgloss/libsysbase/utime.c b/libgloss/libsysbase/utime.cindex 462e86520..14b459eef 100644--- a/libgloss/libsysbase/utime.c+++ b/libgloss/libsysbase/utime.c@@ -35,6 +35,10 @@ int utime(const char *filename, const struct utimbuf *times) t[0].tv_usec = 0; t[1].tv_sec = times->modtime; t[1].tv_usec = 0;+ } else if (gettimeofday(&t[0], NULL) != -1) {+ t[1] = t[0];+ } else {+ return -1; } return utimes(filename, t);-- 2.39.1.windows.1
As per the POSIX specification.Statistics: Posted by Extrems — Wed Apr 19, 2023 2:47 am
Code:
From 7571ec2b7b47f38f95f47909025f9753e4b9c055 Mon Sep 17 00:00:00 2001From: Extrems <metaradil@gmail.com>Date: Tue, 18 Apr 2023 21:31:48 -0400Subject: [PATCH 1/2] Fix off-by-one error in readdir and some minor inconsistencies--- libgloss/libsysbase/dirent.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)diff --git a/libgloss/libsysbase/dirent.c b/libgloss/libsysbase/dirent.cindex bed699102..482d2f814 100644--- a/libgloss/libsysbase/dirent.c+++ b/libgloss/libsysbase/dirent.c@@ -117,6 +117,7 @@ DIR* opendir (const char *dirname) { dirp->position = 0;// 0th position means no file name has been returned yet dirp->fileData.d_ino = -1;+dirp->fileData.d_type = DT_UNKNOWN; dirp->fileData.d_name[0] = '\0'; return dirp;@@ -139,7 +140,7 @@ int closedir (DIR *dirp) { struct dirent* readdir (DIR *dirp) { struct stat st;-char filename[NAME_MAX];+char filename[NAME_MAX+1]; int res; int olderrno = errno; @@ -162,7 +163,7 @@ struct dirent* readdir (DIR *dirp) { // We've moved forward in the directory dirp->position += 1; -if (strnlen(filename, NAME_MAX) >= sizeof(dirp->fileData.d_name)) {+if (strnlen(filename, sizeof(filename)) >= sizeof(dirp->fileData.d_name)) { errno = EOVERFLOW; return NULL; }@@ -177,7 +178,7 @@ struct dirent* readdir (DIR *dirp) { int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { struct stat st;-char filename[NAME_MAX];+char filename[NAME_MAX+1]; int res; if (!dirp) {@@ -200,13 +201,14 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) { // We've moved forward in the directory dirp->position += 1; -if (strnlen(filename, NAME_MAX) >= sizeof(entry->d_name)) {+if (strnlen(filename, sizeof(filename)) >= sizeof(entry->d_name)) { errno = EOVERFLOW; return EOVERFLOW; } strncpy (entry->d_name, filename, sizeof(entry->d_name)); entry->d_ino = st.st_ino;+entry->d_type = IFTODT(st.st_mode); *result = entry; return 0;@@ -224,7 +226,7 @@ void rewinddir (DIR *dirp) { void seekdir(DIR *dirp, long int loc) {-char filename[NAME_MAX];+char filename[NAME_MAX+1]; if (!dirp || loc < 0) { return;-- 2.39.1.windows.1
This is necessary to ensure a working overflow check for VFAT and NTFS file names, which may occupy up to 766 UTF-8 bytes, and for a NUL to be present when a file name is exactly 255 characters.Statistics: Posted by Extrems — Wed Apr 19, 2023 2:45 am
Code:
$ sudo xbps-remove devkitpro-pacman$ sudo xbps-install -S pacman$ sudo cp -r /opt/devkitpro/pacman/var/lib/pacman /var/lib$ sudo pacman-db-upgrade
Statistics: Posted by oreo639 — Tue Jul 07, 2020 9:10 pm
Statistics: Posted by sergiou87 — Sun May 31, 2020 8:17 pm
Statistics: Posted by WinterMute — Sun May 31, 2020 7:36 pm
Statistics: Posted by sergiou87 — Sun May 31, 2020 1:31 pm
Statistics: Posted by WinterMute — Sat Apr 11, 2020 2:00 pm
Statistics: Posted by TheGag96 — Wed Oct 23, 2019 1:52 am
Statistics: Posted by oreo639 — Fri Feb 08, 2019 6:30 am
Code:
./configure --disable-shared CC=/dir to/devkitPPC/bin/powerpc-eabi-gcc --host=ppc --enable-singlethreaded RANLIB=/dir to/devkitPPC/bin/powerpc-eabi-ranlib CFLAGS="-DDEVKITPRO -DNO_WRITEV"make src/libwolfssl.la
Code:
LIBS := /dir to/wolfssl_root/src/.libs/libwolfssl.aCFLAGS := -I/dir to/wolfssl_root/
Code:
#include <gccore.h>#include <wiiuse/wpad.h>...#include <wolfssl/options.h>#include <wolfssl/wolfcrypt/aes.h>/* function built and used by project with devkitPPC */int foo() {Aes aes;byte key[] = {1, 2, …}; /* fill with desired key and iv */byte iv[] = {1, 2, …};byte cipher[AES-BLOCK-SIZE];byte plain[AES-BLOCK-SIZE];int ret;ret = wc_AesSetKey(&aes, key, AES-BLOCK-SIZE, iv, AES_ENCRYPTION); /* handle return value */ ....ret = wc_AesCbcEncrypt(&enc, cipher, msg, AES-BLOCK-SIZE); /* handle return value */ ....return 0;}
Statistics: Posted by jacob — Mon Jan 04, 2016 9:50 pm
Statistics: Posted by mecwerks — Fri Oct 17, 2014 4:47 am
Statistics: Posted by hawkcub — Sun Nov 03, 2013 11:52 am