monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] minor robustness patch


From: Ulrich Drepper
Subject: [Monotone-devel] minor robustness patch
Date: Thu, 12 May 2005 12:20:39 -0700
User-agent: Mozilla Thunderbird 1.0.2-1.3.2 (X11/20050324)

A little patch to add some robustness,  It is important to recognize
corrupt RCS files.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
# 
# patch "rcs_import.cc"
#  from [3e5ca94d659400cda4b3858261ed966cec3d9687]
#    to [0ad197be9182f3e2412e112c6803e336f95e4a76]
# 
--- rcs_import.cc
+++ rcs_import.cc
@@ -334,12 +334,13 @@
   assert(directive.size() > 1);
   ++i;
 
-  char code;
-  int pos, len;
-  sscanf(directive.c_str(), " %c %d %d", &code, &pos, &len);
-
   try 
     {
+      char code;
+      int pos, len;
+      if (sscanf(directive.c_str(), " %c %d %d", &code, &pos, &len) != 3)
+        throw oops("illformed directive '" + directive + "'");
+
       if (code == 'a')
         {
           // 'ax y' means "copy from source to dest until cursor == x, then

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]