File librtas.open_prop_file-off_by_one.patch of Package librtas
alloc the trailing nul as well.
---
librtas_src/ofdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: librtas-1.2.4/librtas_src/ofdt.c
===================================================================
--- librtas-1.2.4.orig/librtas_src/ofdt.c
+++ librtas-1.2.4/librtas_src/ofdt.c
@@ -31,14 +31,14 @@ static int open_prop_file(const char *pr
char *path;
int len;
- len = strlen(prop_path) + strlen(prop_name) + 1;
+ len = strlen(prop_path) + strlen(prop_name) + 1 + 1;
path = malloc(len);
if (path == NULL) {
errno = ENOMEM;
return -1;
}
- sprintf(path, "%s/%s", prop_path, prop_name);
+ snprintf(path, len, "%s/%s", prop_path, prop_name);
*fd = open(path, O_RDONLY);
free(path);