* extract_token() now expects to be supplied with the size of the
[citadel.git] / citadel / setup.c
index 776f30c20d3545572ee6c24cc293cb2c1393baf2..261662671b4ed651f0812940012f70856ab56f4c 100644 (file)
@@ -120,10 +120,10 @@ void set_init_entry(char *which_entry, char *new_state) {
        while(fgets(buf, sizeof buf, fp) != NULL) {
 
                if (num_tokens(buf, ':') == 4) {
-                       extract_token(entry, buf, 0, ':');
-                       extract_token(levels, buf, 1, ':');
-                       extract_token(state, buf, 2, ':');
-                       extract_token(prog, buf, 3, ':'); /* includes 0x0a LF */
+                       extract_token(entry, buf, 0, ':', sizeof entry);
+                       extract_token(levels, buf, 1, ':', sizeof levels);
+                       extract_token(state, buf, 2, ':', sizeof state);
+                       extract_token(prog, buf, 3, ':', sizeof prog); /* includes 0x0a LF */
 
                        if (!strcmp(entry, which_entry)) {
                                strcpy(state, new_state);
@@ -173,8 +173,8 @@ void locate_init_entry(char *init_entry, char *looking_for) {
        } else {
                while (fgets(buf, sizeof buf, infp) != NULL) {
                        buf[strlen(buf) - 1] = 0;
-                       extract_token(entry, buf, 0, ':');      
-                       extract_token(prog, buf, 3, ':');
+                       extract_token(entry, buf, 0, ':', sizeof entry);
+                       extract_token(prog, buf, 3, ':', sizeof prog);
                        if (!strncasecmp(prog, looking_for,
                           strlen(looking_for))) {
                                ++have_entry;
@@ -278,7 +278,7 @@ int yesno(char *question)
                newtCenteredWindow(76, prompt_window_height, "Question");
                form = newtForm(NULL, NULL, 0);
                for (i=0; i<num_tokens(question, '\n'); ++i) {
-                       extract_token(buf, question, i, '\n');
+                       extract_token(buf, question, i, '\n', sizeof buf);
                        newtFormAddComponent(form, newtLabel(1, 1+i, buf));
                }
                yesbutton = newtButton(10, (prompt_window_height - 4), "Yes");
@@ -332,7 +332,7 @@ void important_message(char *title, char *msgtext)
                newtCenteredWindow(76, 10, title);
                form = newtForm(NULL, NULL, 0);
                for (i=0; i<num_tokens(msgtext, '\n'); ++i) {
-                       extract_token(buf, msgtext, i, '\n');
+                       extract_token(buf, msgtext, i, '\n', sizeof buf);
                        newtFormAddComponent(form, newtLabel(1, 1+i, buf));
                }
                newtFormAddComponent(form, newtButton(35, 5, "OK"));
@@ -738,7 +738,7 @@ void strprompt(char *prompt_title, char *prompt_text, char *str)
                                prompt_title);
                form = newtForm(NULL, NULL, 0);
                for (i=0; i<num_tokens(prompt_text, '\n'); ++i) {
-                       extract_token(buf, prompt_text, i, '\n');
+                       extract_token(buf, prompt_text, i, '\n', sizeof buf);
                        newtFormAddComponent(form, newtLabel(1, 1+i, buf));
                }
                newtFormAddComponent(form,