File: 08_no_deref_null

package info (click to toggle)
chntpw 140201-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,100 kB
  • sloc: ansic: 23,909; makefile: 137
file content (16 lines) | stat: -rw-r--r-- 473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Description: Diagnose a missing hive file name with -e.
Forwarded: no
--- a/reged.c
+++ b/reged.c
@@ -167,6 +167,11 @@
 
   if (edit) {  /* Call editor. Rest of arguments are considered hives to load */
     hivename = argv[optind+no_hives];
+    if (!hivename) {
+      fprintf(stderr,"with -e you must specify at least one hive file name\n");
+      usage();
+      exit(1);
+    }
     do {
       if (!(hive[no_hives] = openHive(hivename,
 				      HMODE_RW|mode))) {