mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-31 15:07:43 +00:00
package/config; br2_symbol_printer(): fix off-by-1 in string handling
Based on patch by bbj17@gmx.de. Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
10f9ef7081
commit
3ef31b16c1
@ -16,12 +16,12 @@ Index: config/util.c
|
|||||||
+ char *ret;
|
+ char *ret;
|
||||||
+ if (len < 1)
|
+ if (len < 1)
|
||||||
+ return NULL;
|
+ return NULL;
|
||||||
+ ret = malloc(len);
|
+ ret = malloc(len+1);
|
||||||
+ if (!ret) {
|
+ if (!ret) {
|
||||||
+ printf("Out of memory!");
|
+ printf("Out of memory!");
|
||||||
+ exit(1);
|
+ exit(1);
|
||||||
+ }
|
+ }
|
||||||
+ memset(ret, 0, len);
|
+ memset(ret, 0, len+1);
|
||||||
+ i = j = 0;
|
+ i = j = 0;
|
||||||
+ if (strncmp("BR2_", in, 4) == 0)
|
+ if (strncmp("BR2_", in, 4) == 0)
|
||||||
+ i += 4;
|
+ i += 4;
|
||||||
@ -34,7 +34,7 @@ Index: config/util.c
|
|||||||
+ return ret;
|
+ return ret;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+/* write dependencies of the infividual config-symbols */
|
+/* write dependencies of the individual config-symbols */
|
||||||
+static int write_make_deps(const char *name)
|
+static int write_make_deps(const char *name)
|
||||||
+{
|
+{
|
||||||
+ char *str;
|
+ char *str;
|
||||||
|
@ -35,12 +35,12 @@ static char* br2_symbol_printer(const char * const in)
|
|||||||
char *ret;
|
char *ret;
|
||||||
if (len < 1)
|
if (len < 1)
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = malloc(len);
|
ret = malloc(len+1);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
printf("Out of memory!");
|
printf("Out of memory!");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
memset(ret, 0, len);
|
memset(ret, 0, len+1);
|
||||||
i = j = 0;
|
i = j = 0;
|
||||||
if (strncmp("BR2_", in, 4) == 0)
|
if (strncmp("BR2_", in, 4) == 0)
|
||||||
i += 4;
|
i += 4;
|
||||||
@ -53,7 +53,7 @@ static char* br2_symbol_printer(const char * const in)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write dependencies of the infividual config-symbols */
|
/* write dependencies of the individual config-symbols */
|
||||||
static int write_make_deps(const char *name)
|
static int write_make_deps(const char *name)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user