File: 04_get_abs_path

package info (click to toggle)
chntpw 0.99.6-2
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 1,024 kB
  • ctags: 483
  • sloc: ansic: 5,239; makefile: 92
file content (28 lines) | stat: -rw-r--r-- 673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--- a/ntreg.c
+++ b/ntreg.c
@@ -1193,7 +1193,7 @@
 {
   /* int newnkofs; */
   struct nk_key *key;
-  char tmp[ABSPATHLEN+1];
+  char tmp[ABSPATHLEN];
 
   maxlen = (maxlen < ABSPATHLEN ? maxlen : ABSPATHLEN);
 
@@ -1209,6 +1209,7 @@
   }
 
   strncpy(tmp,path,ABSPATHLEN-1);
+  tmp[ABSPATHLEN-1] = '\0';
 
   if ( (strlen(path) + key->len_name) >= maxlen-6) {
     snprintf(path,maxlen,"(...)%s",tmp);
@@ -1216,7 +1217,7 @@
   }
   *path = '\\';
   memcpy(path+1,key->keyname,key->len_name);
-  strncpy(path+key->len_name+1,tmp,maxlen);
+  strcpy(path+key->len_name+1,tmp);
   return(get_abs_path(hdesc, key->ofs_parent+0x1004, path, maxlen)); /* go back one more */
 }