summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--editmode.c2
-rw-r--r--functions.c6
-rw-r--r--test/testgetline.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 6746525..07442d1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
all: 7ed
7ed:
- gcc -Wfatal-errors -Wall -Werror -Wextra -g 7ed.c functions.c startmode.c editmode.c -o 7ed
+ gcc -Wfatal-errors -Wall -Werror -Wextra -g -fsanitize=address 7ed.c functions.c startmode.c editmode.c -o 7ed
cp 7ed test
mv test/7ed test/7ed-test
clean:
diff --git a/editmode.c b/editmode.c
index b010383..97afbe8 100644
--- a/editmode.c
+++ b/editmode.c
@@ -74,7 +74,7 @@ return 0;
}
-int NEW_LINE(char filename[]) {
+int NEW_LINE(char filename[]) { // testing this now with -fsanitize=address !! Please work!
long new_line_pos;
long new_line_pos_temp;
diff --git a/functions.c b/functions.c
index e5837b7..edba69b 100644
--- a/functions.c
+++ b/functions.c
@@ -156,7 +156,7 @@ int GET_LINE(char filename[], long focus, char **line, size_t *start) { // Makin
c1_count++;
}
} // checks how many characters are in the first line
- char c1buf[c1_count];
+ char c1buf[c1_count+1];
fseek(file, 0, SEEK_SET);
int i = 0;
@@ -207,7 +207,7 @@ int GET_LINE(char filename[], long focus, char **line, size_t *start) { // Makin
}
fseek(file, save_i+1, SEEK_SET);
- char c2buf[c2_count];
+ char c2buf[c2_count+1];
int i = 0;
for (; i < c2_count ; i++) {
c2buf[i] = fgetc(file);
@@ -223,4 +223,4 @@ int GET_LINE(char filename[], long focus, char **line, size_t *start) { // Makin
fclose(file);
return 0;
-} \ No newline at end of file
+}
diff --git a/test/testgetline.c b/test/testgetline.c
index dfbab4b..d186439 100644
--- a/test/testgetline.c
+++ b/test/testgetline.c
@@ -41,4 +41,4 @@ while ((opt = getopt(argc, argv, "i:")) != -1) {
return EXIT_SUCCESS;
// TEST!
-} // LINE 44 YOYOYOYOOYOYOOYOYOYOYOYYO
+// LINE 44 YOOOOOOOOOOOOOOO!!