Chameleon

Chameleon Commit Details

Date:2012-10-01 16:57:44 (11 years 6 months ago)
Author:armel cadet-petit
Commit:2067
Parents: 2066
Message:security fixes
Changes:
M/branches/cparm/i386/modules/GUI/gui.c
M/branches/cparm/i386/libsaio/CoreHash.h
M/branches/cparm/xcode3_sym.zip
M/branches/cparm/i386/modules/GUI/gui.h
M/branches/cparm/i386/libsaio/platform.c
M/branches/cparm/CHANGES

File differences

branches/cparm/CHANGES
1
2
13
24
35
- Security fixes
- Few security fixes
- Fixed a serious bug in picopng
- Fixed a bug in gui.c, related to the images loading
branches/cparm/i386/libsaio/platform.c
359359
360360
361361
362
363362
363
364364
365365
366366
HASH_ITER(hh, platform_env, current_var, tmp) {
HASH_DEL(platform_env,current_var);
if (current_var->name) free(current_var->name);
free(current_var);
}
free(current_var);
}
}
branches/cparm/i386/libsaio/CoreHash.h
194194
195195
196196
197
197
198198
199199
200200
201
202
203
204
201
202
203
204
205205
206206
207207
static void HObj##_DeleteAll(struct HObj *container ) { \
struct HObj *current_var, *tmp; \
\
if (setjmp(uterror) == -1) { \
if (setjmp(uterror) == -1) { \
return;\
} else { \
HASH_ITER(hh, container, current_var, tmp) { \
HASH_DEL(container,current_var); \
if (current_var->name) free(current_var->name); \
free(current_var); \
} \
HASH_DEL(container,current_var); \
if (current_var->name) free(current_var->name); \
} \
free(current_var); \
} \
}
branches/cparm/i386/modules/GUI/gui.c
4848
4949
5050
51
51
52
53
5254
5355
5456
......
6365
6466
6567
68
69
70
71
72
6673
6774
6875
......
10411048
10421049
10431050
1044
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
10451062
1046
1063
10471064
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1065
1066
1067
1068
1069
1070
1071
10591072
10601073
1061
1074
10621075
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1076
10801077
10811078
1082
10831079
10841080
10851081
......
11051101
11061102
11071103
1108
1104
1105
11091106
1110
1111
1112
1113
1114
1115
1116
1117
1107
1108
1109
1110
1111
1112
1113
1114
1115
11181116
11191117
11201118
......
11221120
11231121
11241122
1125
1126
1127
1128
1123
1124
1125
1126
1127
11291128
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1129
1130
1131
11461132
11471133
11481134
1135
1136
1137
1138
1139
1140
11491141
1142
1143
11501144
1151
11521145
1153
11541146
1155
11561147
1148
1149
1150
11571151
11581152
11591153
static config_file_t themeConfig; // theme.plist
themeList_t* themeList = NULL;
// CoreHash Declarations
__CHNewStrVar(themeList_t)
CHUnInit(themeList_t)
static void (*showHelp)(void) = NULL;
static char *(*getMemoryInfoString)(void) = NULL;
#define THEME_NAME_DEFAULT"Default"
const char* theme_name = THEME_NAME_DEFAULT;
#define MAX_THEMES 255
struct themeList_t *gthemeList = NULL;
static char tmp_theme[64]; // should be engouth
char dirsrc[22];
#ifdef EMBED_THEME
gui.screen.font_console_color = (color & 0x00FFFFFF);
}
#define MAX_THEMES 255
static void add_theme(const char *theme, uint8_t nb)
{
struct themeList_t *new_theme;
new_theme = themeList_t_NewStrVar(theme, &gthemeList);
if (!new_theme)
{
return;
}
new_theme->nb = nb;
}
static void add_theme(const char* theme, uint8_t nb)
static char *get_theme_by_index(uint8_t i)
{
themeList_t* new_theme = malloc(sizeof(themeList_t));
if (new_theme)
{
new_theme->next = themeList;
themeList = new_theme;
new_theme->nb = nb;
new_theme->theme = newString(theme);
}
struct themeList_t *current_theme;
for(current_theme=gthemeList;current_theme;current_theme=(struct themeList_t*)(current_theme->hh.next))
{
if (current_theme->nb == i)
return current_theme->name;
}
return NULL;
}
static void free_theme_list()
static void free_theme_list(void)
{
themeList_t* entry = themeList;
while(entry)
{
#if DEBUG_GUI
printf("freeing %s (nb = %d)\n", entry->theme, entry->nb);
#endif
char *theme = entry->theme;
themeList_t* tmp = NULL;
tmp = entry;
entry = entry->next;
free(theme);
free(tmp);
}
themeList_t_DeleteAll(gthemeList);
}
static int randomTheme(char *dirspec, const char **theme) {
long ret, flags, time;
i++;
}
}
#if DEBUG_GUI
themeList_t* debugentry = themeList;
printf("theme list: \n");
while(debugentry)
{
printf("* %s (nb = %d)\n", debugentry->theme, debugentry->nb);
debugentry = debugentry->next;
}
printf("\n");
printf("theme list: \n");
printf("\n");
struct themeList_t *current_theme;
for(current_theme=gthemeList;current_theme;current_theme=(struct themeList_t*)(current_theme->hh.next))
{
printf("* %s (nb = %d)\n", current_theme->name, current_theme->nb);
}
#endif
if (i) {
uint8_t choosen = arc4random_uniform(i);
#if DEBUG_GUI
printf("choosen number (nb = %d), i = %d \n", choosen, i);
#endif
themeList_t* entry = themeList;
while(entry)
#endif
char *tmp = get_theme_by_index(choosen);
if (tmp)
{
if (entry->nb == choosen) {
#if DEBUG_GUI
printf("choosen theme %s (nb = %d)\n", entry->theme, entry->nb);
sleep(1);
#endif
*theme = entry->theme;
sta = startGUI();
break;
}
entry = entry->next;
}
bzero(tmp_theme,sizeof(tmp_theme));
strlcpy(tmp_theme, tmp, sizeof(tmp_theme));
}
free_theme_list();
if (tmp_theme[0])
{
*theme = tmp_theme;
sta = startGUI();
}
}
else
{
#if DEBUG_GUI
else {
printf("No theme found !!\n");
sleep(1);
}
#endif
free_theme_list();
}
return sta;
}
branches/cparm/i386/modules/GUI/gui.h
1818
1919
2020
21
21
2222
2323
2424
......
5656
5757
5858
59
60
61
59
60
6261
6362
6463
#include "bootstruct.h"
#include "graphic_utils.h"
#include "picopng.h"
//#include "options.h"
#include "CoreHash.h"
int GUI_initGraphicsMode (void);
int GUI_countdown( const char * msg, int row, int timeout , int *optionKey);
typedef struct themeList_t
{
char* theme;
unsigned char nb;
struct themeList_t* next;
CoreHashHeader
unsigned char nb;
} themeList_t;
/*

Archive Download the corresponding diff file

Revision: 2067