File: Check-returns-from-the-realpath-function-in-data_file-function

package info (click to toggle)
xbubble 0.5.11.2-3.5
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 8,384 kB
  • sloc: sh: 8,882; ansic: 5,581; makefile: 56; sed: 16
file content (19 lines) | stat: -rw-r--r-- 627 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Description: Checks the return value of realpath() call in data_file()
 This avoids a FTBFS
Author: Thomas Goirand <zigo@debian.org>
Bug-Debian: http://bugs.debian.org/664910
Forwarded: no

--- xbubble-0.5.11.2.orig/src/init.c
+++ xbubble-0.5.11.2/src/init.c
@@ -97,7 +97,9 @@ static char * data_file( const char * fi
       path_max = 4096;
 #endif
     abs_data_dir = (char *) xmalloc( path_max * sizeof(char));
-    realpath( data_dir, abs_data_dir );
+    if(NULL == realpath( data_dir, abs_data_dir )){
+      return NULL;
+    }
     offset = strlen(abs_data_dir);
     if ( offset > 1024-128 )
       offset = 1024-128;